2014-07-13 01:04:16 +02:00
|
|
|
//// [deleteOperatorWithAnyOtherType.ts]
|
|
|
|
// delete operator on any type
|
|
|
|
|
|
|
|
var ANY: any;
|
|
|
|
var ANY1;
|
|
|
|
var ANY2: any[] = ["", ""];
|
|
|
|
var obj: () => {};
|
|
|
|
var obj1 = { x: "", y: () => { }};
|
|
|
|
function foo(): any {
|
|
|
|
var a;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
class A {
|
|
|
|
public a: any;
|
|
|
|
static foo() {
|
|
|
|
var a;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module M {
|
|
|
|
export var n: any;
|
|
|
|
}
|
|
|
|
var objA = new A();
|
|
|
|
|
|
|
|
// any type var
|
|
|
|
var ResultIsBoolean1 = delete ANY1;
|
|
|
|
var ResultIsBoolean2 = delete ANY2;
|
|
|
|
var ResultIsBoolean3 = delete A;
|
|
|
|
var ResultIsBoolean4 = delete M;
|
|
|
|
var ResultIsBoolean5 = delete obj;
|
|
|
|
var ResultIsBoolean6 = delete obj1;
|
|
|
|
|
|
|
|
// any type literal
|
|
|
|
var ResultIsBoolean7 = delete undefined;
|
|
|
|
var ResultIsBoolean8 = delete null;
|
|
|
|
|
|
|
|
// any type expressions
|
|
|
|
var ResultIsBoolean9 = delete ANY2[0];
|
|
|
|
var ResultIsBoolean10 = delete obj1.x;
|
|
|
|
var ResultIsBoolean11 = delete obj1.y;
|
|
|
|
var ResultIsBoolean12 = delete objA.a;
|
|
|
|
var ResultIsBoolean13 = delete M.n;
|
|
|
|
var ResultIsBoolean14 = delete foo();
|
|
|
|
var ResultIsBoolean15 = delete A.foo();
|
|
|
|
var ResultIsBoolean16 = delete (ANY + ANY1);
|
|
|
|
var ResultIsBoolean17 = delete (null + undefined);
|
|
|
|
var ResultIsBoolean18 = delete (null + null);
|
|
|
|
var ResultIsBoolean19 = delete (undefined + undefined);
|
|
|
|
|
|
|
|
// multiple delete operators
|
|
|
|
var ResultIsBoolean20 = delete delete ANY;
|
|
|
|
var ResultIsBoolean21 = delete delete delete (ANY + ANY1);
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
delete ANY;
|
|
|
|
delete ANY1;
|
|
|
|
delete ANY2[0];
|
|
|
|
delete ANY, ANY1;
|
|
|
|
delete obj1.x;
|
|
|
|
delete obj1.y;
|
|
|
|
delete objA.a;
|
|
|
|
delete M.n;
|
|
|
|
|
|
|
|
//// [deleteOperatorWithAnyOtherType.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// delete operator on any type
|
2014-07-13 01:04:16 +02:00
|
|
|
var ANY;
|
|
|
|
var ANY1;
|
|
|
|
var ANY2 = ["", ""];
|
|
|
|
var obj;
|
|
|
|
var obj1 = { x: "", y: function () {
|
|
|
|
} };
|
|
|
|
function foo() {
|
|
|
|
var a;
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
A.foo = function () {
|
|
|
|
var a;
|
|
|
|
return a;
|
|
|
|
};
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var M;
|
|
|
|
(function (M) {
|
|
|
|
M.n;
|
|
|
|
})(M || (M = {}));
|
|
|
|
var objA = new A();
|
2014-08-12 00:54:12 +02:00
|
|
|
// any type var
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean1 = delete ANY1;
|
|
|
|
var ResultIsBoolean2 = delete ANY2;
|
|
|
|
var ResultIsBoolean3 = delete A;
|
|
|
|
var ResultIsBoolean4 = delete M;
|
|
|
|
var ResultIsBoolean5 = delete obj;
|
|
|
|
var ResultIsBoolean6 = delete obj1;
|
2014-08-12 00:54:12 +02:00
|
|
|
// any type literal
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean7 = delete undefined;
|
|
|
|
var ResultIsBoolean8 = delete null;
|
2014-08-12 00:54:12 +02:00
|
|
|
// any type expressions
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean9 = delete ANY2[0];
|
|
|
|
var ResultIsBoolean10 = delete obj1.x;
|
|
|
|
var ResultIsBoolean11 = delete obj1.y;
|
|
|
|
var ResultIsBoolean12 = delete objA.a;
|
|
|
|
var ResultIsBoolean13 = delete M.n;
|
|
|
|
var ResultIsBoolean14 = delete foo();
|
|
|
|
var ResultIsBoolean15 = delete A.foo();
|
|
|
|
var ResultIsBoolean16 = delete (ANY + ANY1);
|
|
|
|
var ResultIsBoolean17 = delete (null + undefined);
|
|
|
|
var ResultIsBoolean18 = delete (null + null);
|
|
|
|
var ResultIsBoolean19 = delete (undefined + undefined);
|
2014-08-12 00:54:12 +02:00
|
|
|
// multiple delete operators
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean20 = delete delete ANY;
|
|
|
|
var ResultIsBoolean21 = delete delete delete (ANY + ANY1);
|
2014-08-16 00:49:09 +02:00
|
|
|
// miss assignment operators
|
2014-07-13 01:04:16 +02:00
|
|
|
delete ANY;
|
|
|
|
delete ANY1;
|
|
|
|
delete ANY2[0];
|
|
|
|
delete ANY, ANY1;
|
|
|
|
delete obj1.x;
|
|
|
|
delete obj1.y;
|
|
|
|
delete objA.a;
|
|
|
|
delete M.n;
|