Skip to content

Commit a61f96a

Browse files
Fix binder inStrictMode initialization (#625)
1 parent 8cf4a33 commit a61f96a

11 files changed

+69
-84
lines changed

internal/binder/binder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func bindSourceFile(file *ast.SourceFile, options *core.CompilerOptions) {
117117
b.file = file
118118
b.options = options
119119
b.languageVersion = options.GetEmitScriptTarget()
120+
b.inStrictMode = options.AlwaysStrict.IsTrue()
120121
b.unreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable)
121122
b.reportedUnreachableFlow = b.newFlowNode(ast.FlowFlagsUnreachable)
122123
b.bind(file.AsNode())
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
alwaysStrict.ts(2,9): error TS1100: Invalid use of 'arguments' in strict mode.
2+
3+
4+
==== alwaysStrict.ts (1 errors) ====
5+
function f() {
6+
var arguments = [];
7+
~~~~~~~~~
8+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
9+
}

testdata/baselines/reference/submodule/compiler/alwaysStrict.errors.txt.diff

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
alwaysStrictES6.ts(2,9): error TS1100: Invalid use of 'arguments' in strict mode.
2+
3+
4+
==== alwaysStrictES6.ts (1 errors) ====
5+
function f() {
6+
var arguments = [];
7+
~~~~~~~~~
8+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
9+
}

testdata/baselines/reference/submodule/compiler/alwaysStrictES6.errors.txt.diff

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
alwaysStrictModule.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
2+
3+
4+
==== alwaysStrictModule.ts (1 errors) ====
5+
module M {
6+
export function f() {
7+
var arguments = [];
8+
~~~~~~~~~
9+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
10+
}
11+
}

testdata/baselines/reference/submodule/compiler/alwaysStrictModule.errors.txt.diff

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
a.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
2+
b.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
3+
4+
5+
==== a.ts (1 errors) ====
6+
module M {
7+
export function f() {
8+
var arguments = [];
9+
~~~~~~~~~
10+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
11+
}
12+
}
13+
14+
==== b.ts (1 errors) ====
15+
module M {
16+
export function f2() {
17+
var arguments = [];
18+
~~~~~~~~~
19+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
20+
}
21+
}

testdata/baselines/reference/submodule/compiler/alwaysStrictModule2.errors.txt.diff

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
alwaysStrictNoImplicitUseStrict.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
2+
3+
4+
==== alwaysStrictNoImplicitUseStrict.ts (1 errors) ====
5+
module M {
6+
export function f() {
7+
var arguments = [];
8+
~~~~~~~~~
9+
!!! error TS1100: Invalid use of 'arguments' in strict mode.
10+
}
11+
}

0 commit comments

Comments
 (0)