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

+1
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())
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

-14
This file was deleted.
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

-14
This file was deleted.
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

-16
This file was deleted.
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

-26
This file was deleted.
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+
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
--- old.alwaysStrictNoImplicitUseStrict.errors.txt
22
+++ new.alwaysStrictNoImplicitUseStrict.errors.txt
3-
@@= skipped -0, +-1 lines =@@
3+
@@= skipped -0, +0 lines =@@
44
-error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
5-
-alwaysStrictNoImplicitUseStrict.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
6-
-
7-
-
5+
alwaysStrictNoImplicitUseStrict.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
6+
7+
88
-!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
9-
-==== alwaysStrictNoImplicitUseStrict.ts (1 errors) ====
10-
- module M {
11-
- export function f() {
12-
- var arguments = [];
13-
- ~~~~~~~~~
14-
-!!! error TS1100: Invalid use of 'arguments' in strict mode.
15-
- }
16-
- }
17-
@@= skipped --1, +1 lines =@@
18-
+<no content>
9+
==== alwaysStrictNoImplicitUseStrict.ts (1 errors) ====
10+
module M {
11+
export function f() {

0 commit comments

Comments
 (0)