Skip to content

Commit 2319665

Browse files
committed
[javascript mode] Improve support for async keyword
Closes codemirror#4085
1 parent 3a9730f commit 2319665

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mode/javascript/javascript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
386386
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
387387
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
388388
if (type == "function") return cont(functiondef, maybeop);
389-
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
389+
if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
390390
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
391391
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
392392
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
@@ -463,6 +463,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
463463
if (type == "variable") {cx.marked = "property"; return cont();}
464464
}
465465
function objprop(type, value) {
466+
if (type == "async") return cont(objprop);
466467
if (type == "variable" || cx.style == "keyword") {
467468
cx.marked = "property";
468469
if (value == "get" || value == "set") return cont(getterSetter);

0 commit comments

Comments
 (0)