2014-07-13 01:04:16 +02:00
|
|
|
//// [logicalNotOperatorWithBooleanType.ts]
|
|
|
|
// ! operator on boolean type
|
|
|
|
var BOOLEAN: boolean;
|
|
|
|
|
|
|
|
function foo(): boolean { return true; }
|
|
|
|
|
|
|
|
class A {
|
|
|
|
public a: boolean;
|
|
|
|
static foo() { return false; }
|
|
|
|
}
|
|
|
|
module M {
|
|
|
|
export var n: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
var objA = new A();
|
|
|
|
|
|
|
|
// boolean type var
|
|
|
|
var ResultIsBoolean1 = !BOOLEAN;
|
|
|
|
|
|
|
|
// boolean type literal
|
|
|
|
var ResultIsBoolean2 = !true;
|
|
|
|
var ResultIsBoolean3 = !{ x: true, y: false };
|
|
|
|
|
|
|
|
// boolean type expressions
|
|
|
|
var ResultIsBoolean4 = !objA.a;
|
|
|
|
var ResultIsBoolean5 = !M.n;
|
|
|
|
var ResultIsBoolean6 = !foo();
|
|
|
|
var ResultIsBoolean7 = !A.foo();
|
|
|
|
|
|
|
|
// multiple ! operators
|
|
|
|
var ResultIsBoolean = !!BOOLEAN;
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
!true;
|
|
|
|
!BOOLEAN;
|
|
|
|
!foo();
|
|
|
|
!true, false;
|
|
|
|
!objA.a;
|
|
|
|
!M.n;
|
|
|
|
|
|
|
|
//// [logicalNotOperatorWithBooleanType.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// ! operator on boolean type
|
2014-07-13 01:04:16 +02:00
|
|
|
var BOOLEAN;
|
|
|
|
function foo() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
var A = (function () {
|
|
|
|
function A() {
|
|
|
|
}
|
|
|
|
A.foo = function () {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
return A;
|
|
|
|
})();
|
|
|
|
var M;
|
|
|
|
(function (M) {
|
|
|
|
M.n;
|
|
|
|
})(M || (M = {}));
|
|
|
|
var objA = new A();
|
2014-08-12 00:54:12 +02:00
|
|
|
// boolean type var
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean1 = !BOOLEAN;
|
2014-08-12 00:54:12 +02:00
|
|
|
// boolean type literal
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean2 = !true;
|
|
|
|
var ResultIsBoolean3 = !{ x: true, y: false };
|
2014-08-12 00:54:12 +02:00
|
|
|
// boolean type expressions
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean4 = !objA.a;
|
|
|
|
var ResultIsBoolean5 = !M.n;
|
|
|
|
var ResultIsBoolean6 = !foo();
|
|
|
|
var ResultIsBoolean7 = !A.foo();
|
2014-08-12 00:54:12 +02:00
|
|
|
// multiple ! operators
|
2014-07-13 01:04:16 +02:00
|
|
|
var ResultIsBoolean = !!BOOLEAN;
|
2014-08-16 00:49:09 +02:00
|
|
|
// miss assignment operators
|
2014-07-13 01:04:16 +02:00
|
|
|
!true;
|
|
|
|
!BOOLEAN;
|
|
|
|
!foo();
|
|
|
|
!true, false;
|
|
|
|
!objA.a;
|
|
|
|
!M.n;
|