Kai Cataldo 2057d2b159
fix: non-directive "use strict" should not enable parsing in strict mode (#11188)
* fix: non-directive "use strict" should not enable parsing in strict mode

* Remove dead code

* Add stricter type annotations

* set oldStrict explicitly to null

* Fix error

* label callback argument

* update comment

* Address feedback

* Remove this.state.octalPosition

* Add additional tests

* Revert "Remove this.state.octalPosition"

This reverts commit bcc78c9530f8c840f85e86053b75efce662f34d1.

* Remove containsOctal

* Report multiple octal literals in single token

* Fix comments

* remove Array.prototype.flat()
2020-03-05 17:34:27 -05:00

161 lines
3.5 KiB
JSON

{
"type": "File",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"errors": [
"SyntaxError: Octal literal in strict mode (1:35)"
],
"program": {
"type": "Program",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "hello"
},
"name": "hello"
},
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 17,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 40
}
},
"body": [],
"directives": [
{
"type": "Directive",
"start": 19,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 32
}
},
"value": {
"type": "DirectiveLiteral",
"start": 19,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 31
}
},
"value": "use strict",
"extra": {
"raw": "'use strict'",
"rawValue": "use strict"
}
}
},
{
"type": "Directive",
"start": 33,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 38
}
},
"value": {
"type": "DirectiveLiteral",
"start": 33,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 37
}
},
"value": "\\1",
"extra": {
"raw": "\"\\1\"",
"rawValue": "\\1"
}
}
}
]
}
}
],
"directives": []
}
}