diff options
Diffstat (limited to 'public/vendor/codemirror/mode/erlang')
-rw-r--r-- | public/vendor/codemirror/mode/erlang/erlang.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/public/vendor/codemirror/mode/erlang/erlang.js b/public/vendor/codemirror/mode/erlang/erlang.js index 5aed76a5..9528e19f 100644 --- a/public/vendor/codemirror/mode/erlang/erlang.js +++ b/public/vendor/codemirror/mode/erlang/erlang.js @@ -433,15 +433,16 @@ CodeMirror.defineMode("erlang", function(cmCfg) { } function maybe_drop_post(s) { + if (!s.length) return s var last = s.length-1; if (s[last].type === "dot") { return []; } - if (s[last].type === "fun" && s[last-1].token === "fun") { + if (last > 1 && s[last].type === "fun" && s[last-1].token === "fun") { return s.slice(0,last-1); } - switch (s[s.length-1].token) { + switch (s[last].token) { case "}": return d(s,{g:["{"]}); case "]": return d(s,{i:["["]}); case ")": return d(s,{i:["("]}); |