svaarala / duktape

Duktape - embeddable Javascript engine with a focus on portability and compact footprint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot parse complex functions

cute-sakura opened this issue · comments

((o) Duktape 2.7.0 (03d4d72-dirty)
duk> function x() { for (i=0; i-10; i++) { try { if (i == 5) throw i} catch {return 10} finally {break} }; return 42 }; x()
SyntaxError: parse error (line 1)
    at [anon] (input:1) internal
    at [anon] (duk_js_compiler.c:511) internal
duk> function x() { var a; return a?.qq; }; x();
SyntaxError: parse error (line 1)
    at [anon] (input:1) internal
    at [anon] (duk_js_compiler.c:3797) internal
duk> function f(){return 0 ?? 42;}; f();
SyntaxError: parse error (line 1)
    at [anon] (input:1) internal
    at [anon] (duk_js_compiler.c:3797) internal

First result should be 42
second = undefined
third = 0

Duktape doesn't yet support the features in the examples yet, namely: catch without a variable, ?. operator, and ?? operator.