fix: token after strict mode block is evaluated in strict mode (#11186)

This commit is contained in:
Kai Cataldo
2020-03-24 03:38:02 -04:00
committed by GitHub
parent 146ea4176e
commit 4e6c9c52ef
4 changed files with 271 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
class X {}
05
function x() { 'use strict' }
05

View File

@@ -0,0 +1,3 @@
{
"sourceType": "script"
}

View File

@@ -0,0 +1,242 @@
{
"type": "File",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 2
}
},
"program": {
"type": "Program",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 5,
"column": 2
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"id": {
"type": "Identifier",
"start": 6,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 7
},
"identifierName": "X"
},
"name": "X"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 8,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 10
}
},
"body": []
}
},
{
"type": "ExpressionStatement",
"start": 11,
"end": 13,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 2
}
},
"expression": {
"type": "NumericLiteral",
"start": 11,
"end": 13,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 2
}
},
"extra": {
"rawValue": 5,
"raw": "05"
},
"value": 5
}
},
{
"type": "FunctionDeclaration",
"start": 15,
"end": 44,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 29
}
},
"id": {
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 10
},
"identifierName": "x"
},
"name": "x"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 28,
"end": 44,
"loc": {
"start": {
"line": 4,
"column": 13
},
"end": {
"line": 4,
"column": 29
}
},
"body": [],
"directives": [
{
"type": "Directive",
"start": 30,
"end": 42,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 27
}
},
"value": {
"type": "DirectiveLiteral",
"start": 30,
"end": 42,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 27
}
},
"value": "use strict",
"extra": {
"raw": "'use strict'",
"rawValue": "use strict"
}
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 45,
"end": 47,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 2
}
},
"expression": {
"type": "NumericLiteral",
"start": 45,
"end": 47,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 2
}
},
"extra": {
"rawValue": 5,
"raw": "05"
},
"value": 5
}
}
],
"directives": []
}
}