Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code of "`" should throw unterminated template literal error #707

Closed
jdalton opened this issue Jun 23, 2018 · 1 comment
Closed

code of "`" should throw unterminated template literal error #707

jdalton opened this issue Jun 23, 2018 · 1 comment

Comments

@jdalton
Copy link
Contributor

jdalton commented Jun 23, 2018

At the moment code of a single tick ` throws an unexpected token error but it should be an unterminated template literal error.

It errors at the this.expect(tt.dollarBraceL) check at

acorn/src/expression.js

Lines 527 to 534 in a2f254a

pp.parseTemplate = function({isTagged = false} = {}) {
let node = this.startNode()
this.next()
node.expressions = []
let curElt = this.parseTemplateElement({isTagged})
node.quasis = [curElt]
while (!curElt.tail) {
this.expect(tt.dollarBraceL)

It could be handled in parseTemplateElement() with a check before setting the .tail to throw the appropriate error or somewhere in readTmplToken.

@jdalton
Copy link
Contributor Author

jdalton commented Sep 10, 2018

Thanks @marijnh!

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

No branches or pull requests

1 participant