amol- / dukpy

Simple JavaScript interpreter for Python
MIT License
483 stars 43 forks source link

Is let keyword not supported? #47

Open HeyITGuyFixIt opened 5 years ago

HeyITGuyFixIt commented 5 years ago

I passed a JavaScript file I have been working on into dukpy's evaljs and got an error. I found the offending line and did some testing and discovered that it doesn't like the let keyword. Some examples of what I used are:

let a;
let b = 5;
let c='hello world';

Each line above (which is valid JavaScript) results in this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\HPOWNE~1\DOCUME~1\CHRIST~1\projects\TDP\thea\KIVY_V~1\lib\site-packages\dukpy\evaljs.py", line 57, in evaljs
    res = _dukpy.eval_string(self, jscode, jsvars)
_dukpy.JSRuntimeError: SyntaxError: unterminated statement (line 1)
        src\pyduktape.c:1
        duk_js_compiler.c:6594

It would seem as if the let keyword is not supported. Is there a reason for that or has it simply not been added yet?

HeyITGuyFixIt commented 5 years ago

Looks like duktape doesn't support it yet. https://github.com/svaarala/duktape/issues/2000