Commit Graph

8 Commits

Author SHA1 Message Date
Tor Andersson
a2fcfd69fe Define built-in functions with the full name.
Improves error messages and stack traces.
2016-04-28 12:57:22 +02:00
Tor Andersson
031513b25b Add stack traces to error objects.
Revert 'add context and flag argument to js_newstate' commit.

The context argument just adds clutter. The flag which was intended
for JS_DEBUG and/or JS_STRICT shouldn't be necessary.

js_newcfunction and js_newcconstructor need an extra argument, the
name of the function to use in stack traces.
2014-12-03 01:18:21 +01:00
Tor Andersson
d366e4b852 Don't pass argc to functions. Use js_gettop instead. 2014-03-12 16:40:48 +01:00
Tor Andersson
70b0d8b902 Change C functions to not have a return value.
They should always push a return value on the JS stack.
2014-02-25 00:56:33 +01:00
Tor Andersson
c7e9ab0b05 Fix signed/unsigned comparison warnings. 2014-02-24 23:55:58 +01:00
Tor Andersson
90b54a9eec Add userdata class.
js_newuserdata(J, tag, ptr) creates a userdata object, wrapping the ptr.
It takes the prototype for the new object from the top of the stack, just
like js_newcconstructor does.

js_touserdata(J, tag, idx) extracts the userdata pointer. Throws a
TypeError if the object is not a userdata object with a matching tag.

js_isuserdata(J, tag, idx) checks if a value on the stack is a userdata
object with a matching tag.
2014-01-24 17:11:49 +01:00
Tor Andersson
195816c208 Set property attributes on built-in objects and respect DontEnum. 2014-01-23 17:53:22 +01:00
Tor Andersson
3a92e13e47 Rename files and move a few functions around. 2014-01-21 13:58:32 +01:00