Identifier with \u{xxxx} doesn't make validation
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 772
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce
es.parse('a\\u{0022}b=1')
Expected output
pares error
Actual output
{
"type": "Program",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "a\"b"
},
"right": {
"type": "Literal",
"value": 1,
"raw": "1"
}
}
}
],
"sourceType": "script"
}
Problem location
scanner.ts:462(getComplexIdentifier)
scanner.ts:490(getComplexIdentifier)
Relevant references
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scanner.ts at getComplexIdentifier around lines 462 and 490, then reproduce the issue with es.parse('a\u{0022}b=1'). The work is done when this invalid identifier produces a parse error instead of an AST containing the decoded name a"b.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100