Strict mode errors
This commit is contained in:
parent
da8557d672
commit
4fcb53b253
2 changed files with 33 additions and 17 deletions
|
@ -1,18 +1,20 @@
|
|||
tests/cases/compiler/a.js(3,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode.
|
||||
tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode.
|
||||
tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/a.js(14,9): error TS1121: Octal literals are not allowed in strict mode.
|
||||
tests/cases/compiler/a.js(14,11): error TS1005: ',' expected.
|
||||
tests/cases/compiler/a.js(15,1): error TS1101: 'with' statements are not allowed in strict mode.
|
||||
tests/cases/compiler/b.js(5,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/b.js(3,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/b.js(6,13): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/c.js(1,12): error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode.
|
||||
tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
|
||||
tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in strict mode.
|
||||
tests/cases/compiler/d.js(2,11): error TS1005: ',' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (9 errors) ====
|
||||
==== tests/cases/compiler/a.js (8 errors) ====
|
||||
"use strict";
|
||||
var a = {
|
||||
a: "hello", // error
|
||||
|
@ -26,6 +28,8 @@ tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are
|
|||
!!! error TS2300: Duplicate identifier 'a'.
|
||||
};
|
||||
var let = 10; // error
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
delete a; // error
|
||||
~
|
||||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
|
||||
|
@ -38,26 +42,25 @@ tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are
|
|||
~~~~~~~~~
|
||||
!!! error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
var x = 009;
|
||||
~~
|
||||
!!! error TS1121: Octal literals are not allowed in strict mode.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
|
||||
with (a) {
|
||||
~~~~
|
||||
!!! error TS1101: 'with' statements are not allowed in strict mode.
|
||||
b = 10;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.js (1 errors) ====
|
||||
==== tests/cases/compiler/b.js (2 errors) ====
|
||||
// this is not in strict mode but class definitions are always in strict mode
|
||||
class c {
|
||||
let() { // error
|
||||
}
|
||||
a(eval) { //error
|
||||
~~~~
|
||||
!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
|
||||
}
|
||||
method() {
|
||||
var let = 10; // error
|
||||
~~~
|
||||
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/c.js (2 errors) ====
|
||||
|
@ -68,3 +71,11 @@ tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are
|
|||
~~~~
|
||||
!!! error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
|
||||
};
|
||||
|
||||
==== tests/cases/compiler/d.js (2 errors) ====
|
||||
"use strict";
|
||||
var x = 009; // error
|
||||
~~
|
||||
!!! error TS1121: Octal literals are not allowed in strict mode.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
|
@ -15,7 +15,7 @@ try {
|
|||
}
|
||||
function arguments() { // error
|
||||
}
|
||||
var x = 009;
|
||||
|
||||
with (a) {
|
||||
b = 10;
|
||||
}
|
||||
|
@ -23,13 +23,18 @@ with (a) {
|
|||
// @filename: b.js
|
||||
// this is not in strict mode but class definitions are always in strict mode
|
||||
class c {
|
||||
let() { // error
|
||||
}
|
||||
a(eval) { //error
|
||||
}
|
||||
method() {
|
||||
var let = 10; // error
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: c.js
|
||||
export var let = 10; // external modules are automatically in strict mode
|
||||
var eval = function () {
|
||||
};
|
||||
|
||||
//@filename: d.js
|
||||
"use strict";
|
||||
var x = 009; // error
|
Loading…
Reference in a new issue