mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Modules are always in strict mode in ES6.
This commit is contained in:
parent
417cfa5c2c
commit
dcbfa6988a
@ -88,7 +88,11 @@ namespace ts {
|
||||
let container: Node;
|
||||
let blockScopeContainer: Node;
|
||||
let lastContainer: Node;
|
||||
let inStrictMode = false;
|
||||
|
||||
// If this file is an external module, then it is automatically in strict-mode according to
|
||||
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
|
||||
// not depending on if we see "use strict" in certain places.
|
||||
let inStrictMode = !!file.externalModuleIndicator;
|
||||
|
||||
let symbolCount = 0;
|
||||
let Symbol = objectAllocator.getSymbolConstructor();
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(3,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(3,1): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts(4,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesAMD.ts (4 errors) ====
|
||||
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(3,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(3,1): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts(4,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesCommonJS.ts (4 errors) ====
|
||||
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(3,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(3,1): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts(4,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesES6.ts (4 errors) ====
|
||||
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(3,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(3,1): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts(4,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesSystem.ts (4 errors) ====
|
||||
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(2,4): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(3,1): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(3,1): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts(4,6): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts (3 errors) ====
|
||||
==== tests/cases/conformance/externalModules/exportNonInitializedVariablesUMD.ts (4 errors) ====
|
||||
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
tests/cases/conformance/es6/modules/t3.ts(1,17): error TS1212: Identifier expected. 'yield' is a reserved word in strict mode
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ====
|
||||
|
||||
let set = {
|
||||
set foo(x: number) {
|
||||
}
|
||||
}
|
||||
let get = 10;
|
||||
|
||||
export { set, get };
|
||||
|
||||
==== tests/cases/conformance/es6/modules/t2.ts (0 errors) ====
|
||||
import * as set from "./t1";
|
||||
|
||||
==== tests/cases/conformance/es6/modules/t3.ts (1 errors) ====
|
||||
import { set as yield } from "./t1";
|
||||
~~~~~
|
||||
!!! error TS1212: Identifier expected. 'yield' is a reserved word in strict mode
|
||||
|
||||
==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ====
|
||||
import { get } from "./t1";
|
||||
@ -1,30 +0,0 @@
|
||||
=== tests/cases/conformance/es6/modules/t1.ts ===
|
||||
|
||||
let set = {
|
||||
>set : Symbol(set, Decl(t1.ts, 1, 3))
|
||||
|
||||
set foo(x: number) {
|
||||
>foo : Symbol(foo, Decl(t1.ts, 1, 11))
|
||||
>x : Symbol(x, Decl(t1.ts, 2, 12))
|
||||
}
|
||||
}
|
||||
let get = 10;
|
||||
>get : Symbol(get, Decl(t1.ts, 5, 3))
|
||||
|
||||
export { set, get };
|
||||
>set : Symbol(set, Decl(t1.ts, 7, 8))
|
||||
>get : Symbol(get, Decl(t1.ts, 7, 13))
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t2.ts ===
|
||||
import * as set from "./t1";
|
||||
>set : Symbol(set, Decl(t2.ts, 0, 6))
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t3.ts ===
|
||||
import { set as yield } from "./t1";
|
||||
>set : Symbol(yield, Decl(t3.ts, 0, 8))
|
||||
>yield : Symbol(yield, Decl(t3.ts, 0, 8))
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t4.ts ===
|
||||
import { get } from "./t1";
|
||||
>get : Symbol(get, Decl(t4.ts, 0, 8))
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
=== tests/cases/conformance/es6/modules/t1.ts ===
|
||||
|
||||
let set = {
|
||||
>set : { foo: number; }
|
||||
>{ set foo(x: number) { }} : { foo: number; }
|
||||
|
||||
set foo(x: number) {
|
||||
>foo : number
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
let get = 10;
|
||||
>get : number
|
||||
>10 : number
|
||||
|
||||
export { set, get };
|
||||
>set : { foo: number; }
|
||||
>get : number
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t2.ts ===
|
||||
import * as set from "./t1";
|
||||
>set : typeof set
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t3.ts ===
|
||||
import { set as yield } from "./t1";
|
||||
>set : { foo: number; }
|
||||
>yield : { foo: number; }
|
||||
|
||||
=== tests/cases/conformance/es6/modules/t4.ts ===
|
||||
import { get } from "./t1";
|
||||
>get : number
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user