Skip to content

Commit

Permalink
Permit quoted names for object destructuring in JavaScript syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw authored and adrianheine committed Nov 12, 2018
1 parent e4ca909 commit 5556fcc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions mode/javascript/javascript.js
Expand Up @@ -655,6 +655,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") cx.marked = "property";
if (type == "spread") return cont(pattern);
if (type == "}") return pass();
if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern);
return cont(expect(":"), pattern, maybeAssign);
}
function eltpattern() {
Expand Down
6 changes: 6 additions & 0 deletions mode/javascript/test.js
Expand Up @@ -226,6 +226,12 @@
" [keyword return] [variable-2 x];",
"}");

MT(
"param_destructuring",
"[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
" [keyword return] [variable-2 x];",
"}");

MT("new_target",
"[keyword function] [def F]([def target]) {",
" [keyword if] ([variable-2 target] [operator &&] [keyword new].[keyword target].[property name]) {",
Expand Down

0 comments on commit 5556fcc

Please sign in to comment.