paperwm / gnome-shell-mode

Package for developing gnome-shell extensions
GNU General Public License v2.0
27 stars 7 forks source link

Function expression wrapped in parentheses does not parse #29

Open olejorgenb opened 5 years ago

olejorgenb commented 5 years ago

let foo = (function() { return 1; })

(function() { return 1; })()

Cause by Reflect.parse weirdness - the opening parenthesis is not included in the span..:

let code = `(function() { return 1; })`;
let body = Reflect.parse (code, {line: 0})
let lines = code.split('\n')
span(lines, body.body[0].loc)
// "function() { return 1; })"

Not trivial to to work around unfortunately.