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

[javascript mode] Accept strings and numbers as type expressions

Closes #4432
parent 460452d7
No related branches found
No related tags found
No related merge requests found
......@@ -539,6 +539,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function typeexpr(type) {
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
if (type == "string" || type == "number") return cont(afterType);
if (type == "{") return cont(commasep(typeprop, "}"))
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
}
......@@ -559,6 +560,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function afterType(type, value) {
if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
if (value == "|") return cont(typeexpr)
if (type == "[") return cont(expect("]"), afterType)
}
function vardef() {
......
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