summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/mode/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/mode/javascript')
-rwxr-xr-xpublic/vendor/codemirror/mode/javascript/javascript.js7
-rwxr-xr-xpublic/vendor/codemirror/mode/javascript/test.js5
2 files changed, 10 insertions, 2 deletions
diff --git a/public/vendor/codemirror/mode/javascript/javascript.js b/public/vendor/codemirror/mode/javascript/javascript.js
index ef018478..c86f49e1 100755
--- a/public/vendor/codemirror/mode/javascript/javascript.js
+++ b/public/vendor/codemirror/mode/javascript/javascript.js
@@ -482,8 +482,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybetype(type) {
if (isTS && type == ":") return cont(typedef);
}
+ function maybedefault(_, value) {
+ if (value == "=") return cont(expressionNoComma);
+ }
function typedef(type) {
- if (type == "variable"){cx.marked = "variable-3"; return cont();}
+ if (type == "variable") {cx.marked = "variable-3"; return cont();}
}
function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
@@ -538,7 +541,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function funarg(type) {
if (type == "spread") return cont(funarg);
- return pass(pattern, maybetype);
+ return pass(pattern, maybetype, maybedefault);
}
function className(type, value) {
if (type == "variable") {register(value); return cont(classNameAfter);}
diff --git a/public/vendor/codemirror/mode/javascript/test.js b/public/vendor/codemirror/mode/javascript/test.js
index 91b0e89a..092d25dc 100755
--- a/public/vendor/codemirror/mode/javascript/test.js
+++ b/public/vendor/codemirror/mode/javascript/test.js
@@ -160,6 +160,11 @@
"]];",
"[number 10];");
+ MT("param_default",
+ "[keyword function] [variable foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
+ " [keyword return] [variable-2 x];",
+ "}");
+
var jsonld_mode = CodeMirror.getMode(
{indentUnit: 2},
{name: "javascript", jsonld: true}