1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
Commit Graph

531 Commits

Author SHA1 Message Date
Robert Krimen
d4a09639a9 Add Array.map (sdgoij) 2013-06-23 14:37:26 +02:00
Robert Krimen
11d011e6a3 Add Array.forEach (sdgoij) 2013-06-23 14:00:01 +02:00
Robert Krimen
b800b809a2 Add Array.some (sdgoij) 2013-06-23 13:48:03 +02:00
Robert Krimen
091c371aea Change handling of undefined in .Export
This fixes #28
2013-06-22 16:33:41 +02:00
Robert Krimen
a4c76f3818 Array.concat does not require length be a Uint32 2013-06-22 15:51:53 +02:00
Robert Krimen
4ebf6416d0 Fix Uint32 Array/String indexing
Also, a bunch of toValue_* streamlining
And maybe a few miscellaneous tweaks
2013-06-22 15:49:22 +02:00
Robert Krimen
48607926f1 Add Array.every (sdgoij) 2013-06-16 15:31:15 -07:00
Robert Krimen
e2eb18cd4c Add toValue_* for more straightforward value conversion
(When the type being converted is obvious.)
2013-06-16 15:12:46 -07:00
Robert Krimen
b95b59a11a Fix Array.indexOf to be compliant with 15.4.4.14 2013-06-16 14:55:30 -07:00
Robert Krimen
2479aa628b Add Array.lastIndexOf (sdgoij) 2013-06-16 14:55:12 -07:00
Robert Krimen
6b4c8ec2b2 Add Array.indexOf (sdgoij) 2013-06-16 14:13:43 -07:00
Robert Krimen
9fe41e1df9 Add Array.toLocaleString 2013-06-15 18:02:13 -07:00
Robert Krimen
81de6c8f02 Fix writable/enumerable/configurable of *.prototype to be false
Number, String, Array, RegExp, Error, etc.
2013-06-15 17:38:16 -07:00
Robert Krimen
98a80a628d Add RegExp.compile
This (useless) function is deprecated, but is here to provide some
semblance of compatibility.
Caveat emptor: it may not be around for long.
2013-06-15 17:17:58 -07:00
Robert Krimen
44fda5c7c3 Add Date.toJSON 2013-06-15 12:56:17 -07:00
Robert Krimen
a34c4d2d1f Add Date.toISOString (sdgoij) 2013-06-15 12:06:33 -07:00
Robert Krimen
14b2fb3918 Fix writable/enumerable/configurable of Object.prototype to be false 2013-06-15 11:44:29 -07:00
Robert Krimen
22ae900958 Fix writable/enumerable/configurable of undefined, NaN, & Infinity to be false 2013-06-15 11:27:41 -07:00
Robert Krimen
70045edc65 Fix Function.prototype to have a length property 2013-06-15 11:01:57 -07:00
Robert Krimen
9af953bb71 Fix Object.prototype to be an Object 2013-06-15 10:45:34 -07:00
Robert Krimen
73bf2f9fa8 Implement return/break/continue without panic/recover
This fixes #25
2013-06-13 22:17:04 -07:00
Robert Krimen
42d674a81b Embiggen test for #24
Make sure we get back out what we put in.
2013-06-09 18:58:35 -07:00
Robert Krimen
d42dcb705e Fix documentation
This fixes #26
2013-06-09 18:58:24 -07:00
Robert Krimen
c55510cb36 Inline context initialization & improve _object.value
* Context setup is now done via _newContext.
* _newContext is a function that resides in inline.go. _newContext is very flat,
resulting in almost no function calls (a 180 from the earlier status quo).
* inline.go is a Go source file that is built by Perl (via inline).
* Lots of crufty functions removed (along with all of their TODO & FIXME).
* In addition, before, the underlying value of _object.value was a pointer to
something. This made for extra work, since the type of _object.value is interface{},
which is already something of a pointer. Now, the underlying value of _object.value
in Function, Date, RegExp, ..., is a struct value.
* type_function.go was streamlined, removing superfluous struct fields and methods.
* There is now less "digging" to get to the actual value of a function, which is important
when makings lots of calls.

Before (without inline):

    PASS
    BenchmarkNew        2000           1067871 ns/op
    ok      github.com/robertkrimen/otto    3.336s
    PASS
    BenchmarkNew        2000           1077644 ns/op
    ok      github.com/robertkrimen/otto    3.367s

After (with inline):

    PASS
    BenchmarkNew       10000            364418 ns/op
    ok      github.com/robertkrimen/otto    4.616s
    PASS
    BenchmarkNew       10000            307241 ns/op
    ok      github.com/robertkrimen/otto    4.051s

This (partially) fixes #22
2013-06-09 18:28:18 -07:00
Robert Krimen
30e4c4b96d Fix .ToValue([]string{...}).Export() to return []string{...}
This fixes #24
2013-06-06 20:18:37 -07:00
Robert Krimen
4aa7e8cc36 Fix race detection incompatibility
This fixes #23
2013-06-06 20:06:41 -07:00
Robert Krimen
506ba2768f Tidy tests (make release, make check, etc.) 2013-06-06 19:57:12 -07:00
Robert Krimen
04ea4a2729 Prevent otto.Value from becoming a _goStructObject
Fix #21, this would happen during .Set(...)
2013-06-05 21:52:59 -07:00
Robert Krimen
61a011e711 Add Object.getOwnPropertyNames (sdgoij) 2013-06-04 20:07:16 -07:00
Robert Krimen
716c307c8d Add Date.toDateString, Date.toTimeString 2013-06-04 19:56:03 -07:00
Robert Krimen
0084268e1f Constantize buildinDate_to*String layout 2013-06-04 19:42:36 -07:00
Robert Krimen
f3d41e0b0c Fix Object built-in attribute defaults (true, false, true) 2013-06-03 18:36:24 -07:00
Robert Krimen
32164a41c9 Fix Date built-in attribute defaults (true, false, true) 2013-06-03 18:36:24 -07:00
Robert Krimen
55565afada Fix global built-in attribute defaults (true, false, true) 2013-06-03 18:36:06 -07:00
Robert Krimen
c6e033bf6c Fix Array initialization (in the case of [,...], etc.) 2013-06-02 16:41:34 -07:00
Robert Krimen
3c8bf4f87c Fix Arguments initialization
Should contain what was passed, not exactly what was declared
2013-06-02 16:25:17 -07:00
Robert Krimen
8b16ca18d8 Add enumeration for Arguments (argumentsEnumerate) 2013-06-02 16:21:49 -07:00
Robert Krimen
1b469aefc1 Add Object.keys (sdgoij) 2013-06-02 16:13:45 -07:00
Robert Krimen
7ff3e8668e Allow (internal) enumeration through _every_ Object property
For .freeze, .isFrozen, etc.
2013-06-02 15:21:25 -07:00
Robert Krimen
baf3318f30 Add Error.prototype.message 2013-06-02 15:03:33 -07:00
Robert Krimen
599d565e55 Use defineOwnProperty (not put) for Array (literal) initialization 2013-06-01 23:11:13 -07:00
Robert Krimen
a8c31cf457 Fix string/array/slice indexing to avoid uint32 => -int issue 2013-06-01 22:17:32 -07:00
Robert Krimen
af47b28fa8 Fix panic when given a generic descriptor in argumentsDefineOwnProperty 2013-06-01 21:59:09 -07:00
Robert Krimen
6669f98a8e Improve type_go_* behavior 2013-05-31 22:50:51 -07:00
Robert Krimen
64182c96bd Handle Ptr properly in type_go_*
Though I'm not sure that &map..., or &[]..., makes sense.
2013-05-30 19:17:57 -07:00
Robert Krimen
f745b98f2b Handle struct, map, & array/slice in exportNative 2013-05-30 18:57:33 -07:00
Robert Krimen
58eefe5c3d Handle toReflectValue of interface{}
Fix #19
2013-05-29 22:45:01 -07:00
Robert Krimen
10bb73298b Edit documentation 2013-05-19 23:03:45 -07:00
Robert Krimen
18630616eb Remove throw behavior from Otto.Call 2013-05-19 21:08:32 -07:00
Robert Krimen
83c56dd73d Add Otto.Call 2013-05-19 19:03:05 -07:00