2014-07-13 01:04:16 +02:00
|
|
|
//// [deleteOperatorWithNumberType.ts]
|
|
|
|
// delete operator on number type
|
|
|
|
var NUMBER: number;
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
|
|
|
|
|
|
|
function foo(): number { return 1; }
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public a: number;
|
|
|
|
static foo() { return 1; }
|
|
|
|
}
|
|
|
|
module M {
|
|
|
|
export var n: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
var objA = new A();
|
|
|
|
|
|
|
|
// number type var
|
|
|
|
var ResultIsBoolean1 = delete NUMBER;
|
|
|
|
var ResultIsBoolean2 = delete NUMBER1;
|
|
|
|
|
|
|
|
// number type literal
|
|
|
|
var ResultIsBoolean3 = delete 1;
|
|
|
|
var ResultIsBoolean4 = delete { x: 1, y: 2};
|
|
|
|
var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } };
|
|
|
|
|
|
|
|
// number type expressions
|
|
|
|
var ResultIsBoolean6 = delete objA.a;
|
|
|
|
var ResultIsBoolean7 = delete M.n;
|
|
|
|
var ResultIsBoolean8 = delete NUMBER1[0];
|
|
|
|
var ResultIsBoolean9 = delete foo();
|
|
|
|
var ResultIsBoolean10 = delete A.foo();
|
|
|
|
var ResultIsBoolean11 = delete (NUMBER + NUMBER);
|
|
|
|
|
|
|
|
// multiple delete operator
|
|
|
|
var ResultIsBoolean12 = delete delete NUMBER;
|
|
|
|
var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER);
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
delete 1;
|
|
|
|
delete NUMBER;
|
|
|
|
delete NUMBER1;
|
|
|
|
delete foo();
|
|
|
|
delete objA.a;
|
|
|
|
delete M.n;
|
|
|
|
delete objA.a, M.n;
|
|
|
|
|
|
|
|
//// [deleteOperatorWithNumberType.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// delete operator on number type
|
2014-07-13 01:04:16 +02:00
|
|
|
var NUMBER;
|
|
|
|
var NUMBER1 = [1, 2];
|
|
|
|
function foo() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
A.foo = function () {
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var M;
|
|
|
|
(function (M) {
|
|
|
|
M.n;
|
|
|
|
})(M || (M = {}));
|
|
|
|
var objA = new A();
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type var
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean1 = delete NUMBER;
|
|
|
|
var ResultIsBoolean2 = delete NUMBER1;
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type literal
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean3 = delete 1;
|
|
|
|
var ResultIsBoolean4 = delete { x: 1, y: 2 };
|
|
|
|
var ResultIsBoolean5 = delete { x: 1, y: function (n) {
|
|
|
|
return n;
|
|
|
|
} };
|
2014-08-12 00:54:12 +02:00
|
|
|
// number type expressions
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean6 = delete objA.a;
|
|
|
|
var ResultIsBoolean7 = delete M.n;
|
|
|
|
var ResultIsBoolean8 = delete NUMBER1[0];
|
|
|
|
var ResultIsBoolean9 = delete foo();
|
|
|
|
var ResultIsBoolean10 = delete A.foo();
|
|
|
|
var ResultIsBoolean11 = delete (NUMBER + NUMBER);
|
2014-08-12 00:54:12 +02:00
|
|
|
// multiple delete operator
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean12 = delete delete NUMBER;
|
|
|
|
var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER);
|
2014-08-16 00:49:09 +02:00
|
|
|
// miss assignment operators
|
2014-07-13 01:04:16 +02:00
|
|
|
delete 1;
|
|
|
|
delete NUMBER;
|
|
|
|
delete NUMBER1;
|
|
|
|
delete foo();
|
|
|
|
delete objA.a;
|
|
|
|
delete M.n;
|
|
|
|
delete objA.a, M.n;
|