Remove Modifier::TemplateTail

RESOLVED FIXED in Firefox 68

Status

()

enhancement
P2
normal
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: jorendorff, Assigned: jorendorff)

Tracking

unspecified
mozilla68
Points:
---

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

3 months ago

The standard uses the same language to specify the lexical grammar of both template tails and RegExp literals, but in practice we implement those two quirks in totally different ways.

But TemplateTail is thrown into Modifier (our solution for the RegExp problem) anyway, even though it's not relevant there. One consequence of this is that there's a very cold check for Modifier::TemplateTail at the top of TokenStreamSpecific<>::getTokenInternal, which is very hot code. Let's remove that.

Separately: when we do scan a token in TemplateTail mode, we produce either a TemplateHead (meaning TemplateMiddle) or NoSubsTemplate (meaning TemplateTail) token. I wrote a comment documenting this, but it felt silly. So I am going to splurge and purchase two new TokenKind enumerators for TemplateMiddle and TemplateTail.

Assignee

Comment 1

3 months ago

Hmm. Well, these two goals are kind of at odds; having nice non-silly TokenKinds requires passing another bit to getStringOrTemplateToken (since it has to choose what TokenKinds to use to describe whatever it's parsing) and this is getting a little into the weeds already. So I'm going to leave the TokenKinds silly and just get rid of Modifier::TemplateTail.

Assignee

Comment 2

3 months ago

This patch also adds TokenKind::TemplateMiddle and TemplateTail. Previously
NoSubsTemplate was used for TemplateTail, and TemplateHead was used for
TemplateMiddle.

Comment 4

2 months ago
Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a7adb4cb7f66
Remove Modifier::TemplateTail. r=jwalden

Comment 5

2 months ago
bugherder
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → jorendorff
You need to log in before you can comment on or make changes to this bug.