Tor Andersson
9f34a074eb
Revert "Bug 701886: Always create new scope for eval()."
...
This reverts commit d248b0ce18 .
2021-03-04 12:08:42 +01:00
Tor Andersson
8f12e045f6
Return "[object Iterator]" when running toString on an iterator value.
2020-03-17 14:10:18 +01:00
Tor Andersson
d248b0ce18
Bug 701886: Always create new scope for eval().
...
Distinguish eval code from script code.
2020-01-02 14:37:05 +01:00
Tor Andersson
5de1f97c52
Set appropriate internal class property of arguments object.
2019-03-18 14:11:34 +01:00
Tor Andersson
ed1c279896
Fix indentation.
2019-03-18 14:00:02 +01:00
Tor Andersson
bd2470847c
Fix logic in Object.isFrozen to comply with spec.
2018-07-16 13:28:04 +02:00
Tor Andersson
2b4d05a575
Revert 'Maintain order of property enumeration by keeping a linked list.'
...
Reduce memory use per property by not keeping the properties in two
parallel data structures. Maintaining the order of insertion is not
required by the spec, and is not a very useful feature.
2017-05-09 13:52:11 +02:00
Tor Andersson
89793bba03
Fix Object.prototype.toString when called with null or undefined this.
2016-06-10 15:22:07 +01:00
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
3e3c382a0c
Avoid using 'unsigned int'.
...
Mixing signed and unsigned ints is just a plain headache.
2016-04-27 16:26:00 +02:00
Tor Andersson
c90c32326e
Fix bugs introduced when moving from argc to js_gettop.
...
The 'length' field of a function is used to fill in missing arguments
with undefined; this does not mesh well with functions that query for
missing arguments using js_gettop. Set their lengths to 0 instead.
2016-04-15 12:18:34 +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
5dbd120154
Fix several constructors.
...
"is/was supplied/specified" is different from "is not undefined" which
is used in most of the spec.
2014-03-13 13:36:29 +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
b8aa34d919
JSON skeleton.
2014-02-10 13:41:28 +01:00
Tor Andersson
31acf8517f
Expose magic properties in Object.keys and Object.getOwnPropertyNames.
2014-02-07 16:52:06 +01:00
Tor Andersson
d59d0e2721
Make argc/undefined checks more resilient.
2014-02-07 15:45:08 +01:00
Tor Andersson
979c7bc1bd
Implement extensible object attribute.
2014-02-07 10:57:52 +01:00
Tor Andersson
a09493e144
Implement ES5 prototype descriptor and misc object functions.
2014-02-07 00:44:49 +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
0fd3f364ec
Add iterator object class for internal use in for-in loops.
...
Flatten all enumerable properties in object prototype chain
into a linked list to enumerate.
2014-01-23 10:07:22 +01:00
Tor Andersson
3a92e13e47
Rename files and move a few functions around.
2014-01-21 13:58:32 +01:00
Tor Andersson
b262cc3673
Rename many jsR functions to jsV.
...
Danger! jsV work on values internally without the stack.
Also rearrange how C-constructors are created.
2014-01-20 17:44:56 +01:00
Tor Andersson
40a12fba0d
Split header into js.h public and jsi.h private. Start cleaning up
...
private function prefixes.
2014-01-20 16:13:09 +01:00
Tor Andersson
f3ea55fc64
Implement String.prototype.charAt and charCodeAt.
2014-01-19 15:06:10 +01:00
Tor Andersson
ce0a690a04
Create readonly length property on string objects.
2014-01-19 14:25:00 +01:00
Tor Andersson
95ac24c7cf
Put js_Object contents in a union.
2014-01-19 13:29:38 +01:00
Tor Andersson
1237388b8e
More builtins. Fix prototype chains for builtin classes and prototypes.
2014-01-19 01:50:41 +01:00
Tor Andersson
a592f61f36
Implement Number and Object classes.
...
Split built-in functions into one file per class.
2014-01-18 22:04:37 +01:00
Tor Andersson
24f48308ce
Support 'typeof' operator.
2014-01-18 17:38:40 +01:00
Tor Andersson
f8ff865248
Move object creation functions into jsobject.c
2014-01-18 01:22:11 +01:00
Tor Andersson
81b2bb9ca4
Add constructors called with 'new' keyword.
...
Support built-in constructors that create their own objects. They get
called without a this object, which they should create and push on the
stack.
2014-01-17 22:03:35 +01:00
Tor Andersson
f487a7db10
Set prototype internal property when creating objects.
2014-01-17 19:41:41 +01:00
Tor Andersson
10ffd559de
Compile global/eval code as script objects rather than regular functions.
...
Handle scoping rules ath the js_call level instead of having to use
separate functions to call on the objects.
2014-01-17 15:58:51 +01:00
Tor Andersson
288eef80e1
Clean up. Rearrange files. Rename functions.
2014-01-16 20:48:43 +01:00
Tor Andersson
ede0f888ce
Prepare for objects with internal properties, and closures as objects.
2014-01-15 23:41:41 +01:00
Tor Andersson
6b1906f3b5
Add for-in iterator.
2014-01-15 00:36:22 +01:00
Tor Andersson
f77a6e7e8e
Implement value stack and use it in the interpreter.
...
We can now run simple programs that don't use function calls.
2014-01-14 18:17:06 +01:00
Tor Andersson
a4cc139e1c
Add js_Object with js_Property binary search tree.
...
Use object to represent a variable record and implement variable
loading and storing in the interpreter.
2014-01-13 21:32:33 +01:00