@@ -42,7 +42,6 @@ const (
42
42
43
43
type Binder struct {
44
44
file * ast.SourceFile
45
- languageVersion core.ScriptTarget
46
45
bindFunc func (* ast.Node ) bool
47
46
unreachableFlow * ast.FlowNode
48
47
reportedUnreachableFlow * ast.FlowNode
@@ -121,7 +120,6 @@ func bindSourceFile(file *ast.SourceFile) {
121
120
b := getBinder ()
122
121
defer putBinder (b )
123
122
b .file = file
124
- b .languageVersion = b .options ().EmitScriptTarget
125
123
b .inStrictMode = b .options ().BindInStrictMode && ! file .IsDeclarationFile || ast .IsExternalModule (file )
126
124
b .unreachableFlow = b .newFlowNode (ast .FlowFlagsUnreachable )
127
125
b .reportedUnreachableFlow = b .newFlowNode (ast .FlowFlagsUnreachable )
@@ -1181,7 +1179,6 @@ func (b *Binder) bindParameter(node *ast.Node) {
1181
1179
func (b * Binder ) bindFunctionDeclaration (node * ast.Node ) {
1182
1180
b .checkStrictModeFunctionName (node )
1183
1181
if b .inStrictMode {
1184
- b .checkStrictModeFunctionDeclaration (node )
1185
1182
b .bindBlockScopedDeclaration (node , ast .SymbolFlagsFunction , ast .SymbolFlagsFunctionExcludes )
1186
1183
} else {
1187
1184
b .declareSymbolAndAddToSymbolTable (node , ast .SymbolFlagsFunction , ast .SymbolFlagsFunctionExcludes )
@@ -1364,17 +1361,6 @@ func (b *Binder) checkStrictModeFunctionName(node *ast.Node) {
1364
1361
}
1365
1362
}
1366
1363
1367
- func (b * Binder ) checkStrictModeFunctionDeclaration (node * ast.Node ) {
1368
- if b .languageVersion < core .ScriptTargetES2015 {
1369
- // Report error if function is not top level function declaration
1370
- if b .blockScopeContainer .Kind != ast .KindSourceFile && b .blockScopeContainer .Kind != ast .KindModuleDeclaration && ! ast .IsFunctionLikeOrClassStaticBlockDeclaration (b .blockScopeContainer ) {
1371
- // We check first if the name is inside class declaration or class expression; if so give explicit message
1372
- // otherwise report generic error message.
1373
- b .errorOnNode (node , b .getStrictModeBlockScopeFunctionDeclarationMessage (node ))
1374
- }
1375
- }
1376
- }
1377
-
1378
1364
func (b * Binder ) getStrictModeBlockScopeFunctionDeclarationMessage (node * ast.Node ) * diagnostics.Message {
1379
1365
// Provide specialized messages to help the user understand why we think they're in strict mode.
1380
1366
if ast .GetContainingClass (node ) != nil {
@@ -1443,7 +1429,7 @@ func (b *Binder) checkStrictModeWithStatement(node *ast.Node) {
1443
1429
1444
1430
func (b * Binder ) checkStrictModeLabeledStatement (node * ast.Node ) {
1445
1431
// Grammar checking for labeledStatement
1446
- if b .inStrictMode && b . options (). EmitScriptTarget >= core . ScriptTargetES2015 {
1432
+ if b .inStrictMode {
1447
1433
data := node .AsLabeledStatement ()
1448
1434
if ast .IsDeclarationStatement (data .Statement ) || ast .IsVariableStatement (data .Statement ) {
1449
1435
b .errorOnFirstToken (data .Label , diagnostics .A_label_is_not_allowed_here )
0 commit comments