Skip to content

Conversation

@mysticatea
Copy link
Contributor

Fixes #575.

In src/tokencontext.js#L112-L119, class and function keywords push new context into this.context. However, there is no chance to pop the context from this.context if the keyword was consumed as an identifier such as {class: 1}. This fact breaks the tokenization of template literals.

This PR makes popping the context when a class/function keyword is consumed as an identifier.

I'm not sure whether this fixing is correct or not. Because this bug is in tokenization process, but this PR modifies parsing process. Please tell me (or feel free to fix it yourself) if the more proper way exists.

@marijnh marijnh merged commit ccfd59d into acornjs:master Sep 18, 2017
@marijnh
Copy link
Member

marijnh commented Sep 18, 2017

Thanks, I've merged this. It's technically a bit problematic, because it breaks the separation between the tokenizer and the parser, and thus won't help tokenize such programs, but I can't think of a good way to distinguish identifiers in object literal property or class method position during tokenizing, so we'll just have to live with that for now.

@mysticatea mysticatea deleted the issue_haiku branch September 18, 2017 13:58
@mysticatea
Copy link
Contributor Author

@marijnh could you make a new release?

@marijnh
Copy link
Member

marijnh commented Oct 29, 2017

Sure. I've released 5.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in 5.1.1 related to template literals

2 participants