Skip to content
Snippets Groups Projects
Commit a31c335e authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[javascript mode] Use 'extends' instead of parenthesized syntax for inheritance

parent d85b8c4c
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
"in": operator, "typeof": operator, "instanceof": operator,
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
"this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"),
"yield": C, "export": kw("export"), "import": kw("import")
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
};
// Extend the 'normal' keywords with the TypeScript language extensions
......@@ -502,8 +502,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function className(type, value) {
if (type == "variable") {register(value); return cont(classNameAfter);}
}
function classNameAfter(type) {
if (type == "(") return pass(expression);
function classNameAfter(_type, value) {
if (value == "extends") return cont(expression);
}
function objlit(type) {
if (type == "{") return cont(commasep(objprop, "}"));
......
......@@ -15,7 +15,7 @@
"})();");
MT("class",
"[keyword class] [variable Point]([variable SuperThing]) {",
"[keyword class] [variable Point] [keyword extends] [variable SuperThing] {",
" [[ [string-2 /expr/] ]]: [number 24],",
" [property constructor]([def x], [def y]) {",
" [keyword super]([string 'something']);",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment