Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

[javascript] Brackets gets confused by ${new.target} #11905

Closed
nicolo-ribaudo opened this issue Nov 10, 2015 · 5 comments
Closed

[javascript] Brackets gets confused by ${new.target} #11905

nicolo-ribaudo opened this issue Nov 10, 2015 · 5 comments
Assignees
Milestone

Comments

@nicolo-ribaudo
Copy link
Contributor

class A {
  constructor() {
    console.log(`${new.target}`);
  }
}
  1. I can collapse neither class A { nor constructor() {
  2. All the code after new.target} is highlighted as a string
  3. If you delete the last and rewrite it, Brackets will append another (e.g. console.log(`${new.target}``);)
@petetnt
Copy link
Collaborator

petetnt commented Nov 11, 2015

new is a reserved keyword in EcmaScript which breaks the parser when used in such way. If you change new to something else, it works as intended

@nicolo-ribaudo
Copy link
Contributor Author

new.target is valid JsvaScript. (try to copy that code in the Chrome console)

@petetnt
Copy link
Collaborator

petetnt commented Nov 11, 2015

@nicolo-ribaudo oh that's neat 😮 new.target REF, didn't know that. You learn something new everyday! 🆒

You can work around it by assigning it as variable, but it would be neat if you could report this to https://github.com/codemirror/CodeMirror/issues as it is a CodeMirror issue

@nicolo-ribaudo
Copy link
Contributor Author

@petetnt Thank you, I can't reproduce this issue in the online CodeMirror demo, I think this can be fixed updating CodeMirror.

@petetnt
Copy link
Collaborator

petetnt commented Nov 11, 2015

@nicolo-ribaudo Yup, it was implemented mere 22 days ago at codemirror/codemirror5@4574683

ping @marcelgerber

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@marcelgerber @abose @nicolo-ribaudo @petetnt and others