cesanta / v7

Embedded JavaScript engine for C/C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Object.prototype.toString.call(undefined)

cancerberoSgx opened this issue · comments

v7 -e "Object.prototype.toString.call(undefined)"
Exec error [Object.prototype.toString.call(undefined)]: "cannot read property 'constructor' of undefined"

This shouldn't fail or at least it works in all other engines I know including v8, rhino, jjs and browsers. Library that internally use this code is http://momentjs.com/

BTW: debugging the cause of this error was a pain. Do you know some switch in v7 to print the line number where the exception occurs ?

BTW2 I'm playing with browserify and libraries like underscore, momentjs, lodash etc and in general v7 works fine, the only exception so far was this error.

Thanks!

error numbers reporting is enabled in master by default

In general error reporting has been greatly improved:

mkm@marko $ cat >/tmp/foo.js
var foo = {};
foo.bar();
mkm@marko $ ./v7 /tmp/foo.js
Exec error [/tmp/foo.js]: "foo.bar is not a function"
    at /tmp/foo.js:2
undefined

Thank you very much! is working fine now. BTW now momentjs is working but with a little workaround, but this time is their fault : moment/moment#3185 - I'm doing this Date.prototype.getYear = Date.prototype.getFullYear; maybe you want to include that but is not an issue!
Thank you again, good project, keep it up!