Skip to content

[parser] Tagged template with \8 should set value to null #10437

@pvdz

Description

@pvdz

Bug Report

Current Behavior

Minor AST issue; The \8 and \9 are illegal escapes. In tagged template these should be recognized as bad escapes and set the .value property in the AST to null to reflect this.

Input Code

`\8`
`\9`

Expected behavior/code

For templates, an escape \8 and \9 end up as NotEscapeSequence
https://tc39.es/ecma262/#prod-NotEscapeSequence

The string value of that escape is undefined:
https://tc39.es/ecma262/#sec-static-semantics-tv-and-trv

The TV of TemplateCharacter :: \ NotEscapeSequence is undefined.

As such, the .value property in the AST nodes should be null to reflect this, like with other bad escapes.

Environment
Babel 7.5.5

Possible Solution

I think there's an exception to 8 and 9. Do the same as happens with \1 ~ \7. This is for tagged templates only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has PRclaimedoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions