enabled strict mode

This commit is contained in:
Vladimir Matveev
2014-07-23 10:40:39 -07:00
parent d10f2e713e
commit 259f8a2091
38 changed files with 250 additions and 214 deletions

View File

@@ -0,0 +1,8 @@
==== tests/cases/compiler/constructorStaticParamNameErrors.ts (1 errors) ====
'use strict'
// static as constructor parameter name should give error if 'use strict'
class test {
constructor (static) { }
~~~~~~
!!! Identifier expected.
}

View File

@@ -1,14 +0,0 @@
//// [constructorStaticParamNameErrors.ts]
'use strict'
// static as constructor parameter name should give error if 'use strict'
class test {
constructor (static) { }
}
//// [constructorStaticParamNameErrors.js]
'use strict';
var test = (function () {
function test(static) {
}
return test;
})();

View File

@@ -0,0 +1,10 @@
==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ====
"use strict";
var x = {
x: 1,
x: 2
~
!!! Object literal cannot contain more than one property with the same name in the strict mode.
~
!!! Duplicate identifier 'x'.
}

View File

@@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (4 errors) ====
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
@@ -18,4 +18,10 @@
~~~~~~~~~~~~~
!!! Cannot find name 'NotEarlyError'.
var public = 1;
~~~~~~
!!! Variable declaration expected.
~
!!! Variable declaration expected.
~
!!! Variable declaration expected.

View File

@@ -1,25 +0,0 @@
//// [parser10.1.1-8gs.ts]
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch10/10.1/10.1.1/10.1.1-8gs.js
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code
* @noStrict
* @negative ^((?!NotEarlyError).)*$
*/
"use strict";
"use strict";
throw NotEarlyError;
var public = 1;
//// [parser10.1.1-8gs.js]
"use strict";
"use strict";
throw NotEarlyError;
var public = 1;

View File

@@ -0,0 +1,9 @@
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts (1 errors) ====
"use strict";
class test {
constructor (static) { }
~~~~~~
!!! Identifier expected.
}

View File

@@ -1,15 +0,0 @@
//// [parser642331_1.ts]
"use strict";
class test {
constructor (static) { }
}
//// [parser642331_1.js]
"use strict";
var test = (function () {
function test(static) {
}
return test;
})();

View File

@@ -0,0 +1,6 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode10.ts (1 errors) ====
"use strict";
function f(eval) {
~~~~
!!! Invalid use of 'eval' in strict mode.
}

View File

@@ -1,9 +0,0 @@
//// [parserStrictMode10.ts]
"use strict";
function f(eval) {
}
//// [parserStrictMode10.js]
"use strict";
function f(eval) {
}

View File

@@ -0,0 +1,6 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode11.ts (1 errors) ====
"use strict";
var v = function f(eval) {
~~~~
!!! Invalid use of 'eval' in strict mode.
};

View File

@@ -1,9 +0,0 @@
//// [parserStrictMode11.ts]
"use strict";
var v = function f(eval) {
};
//// [parserStrictMode11.js]
"use strict";
var v = function f(eval) {
};

View File

@@ -1,5 +1,5 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode12.ts (1 errors) ====
"use strict";
var v = { set foo(eval) { } }
~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
~~~~
!!! Invalid use of 'eval' in strict mode.

View File

@@ -0,0 +1,8 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode13.ts (1 errors) ====
"use strict";
try {
}
catch(eval) {
~~~~
!!! Invalid use of 'eval' in strict mode.
}

View File

@@ -1,13 +0,0 @@
//// [parserStrictMode13.ts]
"use strict";
try {
}
catch(eval) {
}
//// [parserStrictMode13.js]
"use strict";
try {
}
catch (eval) {
}

View File

@@ -1,6 +1,9 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (2 errors) ====
"use strict";
with (a) {
~~~~~~~~~~
~
!!! Cannot find name 'a'.
}
}
~
!!! 'with' statements are not allowed in strict mode.

View File

@@ -1,9 +0,0 @@
//// [parserStrictMode14.ts]
"use strict";
with (a) {
}
//// [parserStrictMode14.js]
"use strict";
with (a) {
}

View File

@@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts (4 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts (5 errors) ====
"use strict";
foo1();
~~~~
@@ -11,4 +11,6 @@
!!! Cannot find name 'foo1'.
static();
~~~~~~
!!! Cannot find name 'static'.
!!! Declaration or statement expected.
~
!!! '=>' expected.

View File

@@ -1,13 +0,0 @@
//// [parserStrictMode2.ts]
"use strict";
foo1();
foo1();
foo1();
static();
//// [parserStrictMode2.js]
"use strict";
foo1();
foo1();
foo1();
static();

View File

@@ -1,5 +1,7 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode3.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode3.ts (2 errors) ====
"use strict";
eval = 1;
~~~~
!!! Invalid use of 'eval' in strict mode.
~~~~
!!! Invalid left-hand side of assignment expression.

View File

@@ -1,7 +0,0 @@
//// [parserStrictMode3.ts]
"use strict";
eval = 1;
//// [parserStrictMode3.js]
"use strict";
eval = 1;

View File

@@ -1,5 +1,7 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode4.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode4.ts (2 errors) ====
"use strict";
arguments = 1;
~~~~~~~~~
!!! Invalid use of 'arguments' in strict mode.
~~~~~~~~~
!!! Cannot find name 'arguments'.

View File

@@ -1,7 +0,0 @@
//// [parserStrictMode4.ts]
"use strict";
arguments = 1;
//// [parserStrictMode4.js]
"use strict";
arguments = 1;

View File

@@ -1,5 +1,7 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode5.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode5.ts (2 errors) ====
"use strict";
eval += 1;
~~~~
!!! Invalid use of 'eval' in strict mode.
~~~~~~~~~
!!! Operator '+=' cannot be applied to types '(x: string) => any' and 'number'.

View File

@@ -1,7 +0,0 @@
//// [parserStrictMode5.ts]
"use strict";
eval += 1;
//// [parserStrictMode5.js]
"use strict";
eval += 1;

View File

@@ -1,5 +1,7 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode6.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode6.ts (2 errors) ====
"use strict";
eval++;
~~~~
!!! Invalid use of 'eval' in strict mode.
~~~~
!!! An arithmetic operand must be of type 'any', 'number' or an enum type.

View File

@@ -1,7 +0,0 @@
//// [parserStrictMode6.ts]
"use strict";
eval++;
//// [parserStrictMode6.js]
"use strict";
eval++;

View File

@@ -1,6 +1,8 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode8.ts (1 errors) ====
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode8.ts (2 errors) ====
"use strict";
function eval() {
~~~~
!!! Invalid use of 'eval' in strict mode.
~~~~
!!! Overload signatures must all be ambient or non-ambient.
}

View File

@@ -1,9 +0,0 @@
//// [parserStrictMode8.ts]
"use strict";
function eval() {
}
//// [parserStrictMode8.js]
"use strict";
function eval() {
}

View File

@@ -0,0 +1,6 @@
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode9.ts (1 errors) ====
"use strict";
var v = function eval() {
~~~~
!!! Invalid use of 'eval' in strict mode.
};

View File

@@ -1,9 +0,0 @@
//// [parserStrictMode9.ts]
"use strict";
var v = function eval() {
};
//// [parserStrictMode9.js]
"use strict";
var v = function eval() {
};

View File

@@ -1,4 +1,4 @@
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (1 errors) ====
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (4 errors) ====
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
@@ -18,4 +18,10 @@
~~~~~~~~~~~~~
!!! Cannot find name 'NotEarlyError'.
var public = 1;
~~~~~~
!!! Variable declaration expected.
~
!!! Variable declaration expected.
~
!!! Variable declaration expected.

View File

@@ -1,25 +0,0 @@
//// [scanner10.1.1-8gs.ts]
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch10/10.1/10.1.1/10.1.1-8gs.js
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code
* @noStrict
* @negative ^((?!NotEarlyError).)*$
*/
"use strict";
"use strict";
throw NotEarlyError;
var public = 1;
//// [scanner10.1.1-8gs.js]
"use strict";
"use strict";
throw NotEarlyError;
var public = 1;

View File

@@ -0,0 +1,5 @@
"use strict";
var x = {
x: 1,
x: 2
}