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

409 Commits

Author SHA1 Message Date
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
Robert Krimen
3c139264ef Handle ToValue(nil) 2013-05-19 17:43:08 -07:00
Robert Krimen
e2e79bb697 A Value panic during a FunctionCall is the same as a throw in JavaScript 2013-05-19 15:54:10 -07:00
Robert Krimen
791a2c0c8e Add FunctionCall.Otto 2013-05-19 14:57:01 -07:00
Robert Krimen
0b8a079525 Remove FunctionCall.Run 2013-05-19 14:56:41 -07:00
Robert Krimen
cced87b8e6 Add FunctionCall.Run 2013-05-18 16:24:55 -07:00
Robert Krimen
699232d49a Consolidate run/runSafe into _runtime 2013-05-18 16:18:17 -07:00
Robert Krimen
d2eaa4aab6 Add Object.seal (sdgoij) 2013-05-18 15:56:52 -07:00
Robert Krimen
bdd28e5938 Revamp property mode bit fiddling (write, enumerate, configure) 2013-05-18 15:56:35 -07:00
Robert Krimen
adf21d0208 No rush to change the interface of Value.Export() 2013-05-15 19:30:39 -07:00
Robert Krimen
faaed09553 Change Export() to have new interface and slightly different behavior 2013-05-15 19:04:39 -07:00
Robert Krimen
15539ede6c Add Object.freeze (sdgoij) 2013-05-12 14:54:47 -07:00
Robert Krimen
7e2b4f2063 Rewrite of property handling to be more robust and compliant
* No more _stash
* Now using a "virtual table" system via _objectClass
* Make Array.concat GoArray compatible (via .isArray())

Fix #16
2013-05-12 14:14:51 -07:00
Robert Krimen
58e455b80f Mock location as UTC for date testing 2013-05-05 11:26:34 -07:00
Robert Krimen
d1d4d939ea Add Object.isSealed & Object.isFrozen 2013-05-05 10:35:32 -07:00
Robert Krimen
2e20275e07 Add check for testing against the release version of Go 2013-05-05 10:23:18 -07:00
Robert Krimen
696272f7d6 Fix Local/UTC conversion discrepancy in newDateTime 2013-05-05 09:18:16 -07:00
Robert Krimen
683e3956aa Add Object.isExtensible & Object.preventExtensions...
...and fix the deep implementation of defineOwnProperty
so that they can work (more or less) properly
2013-05-03 22:24:51 +02:00
Robert Krimen
2e0fe63a64 Fix: parse_statement.go:184: function ends without a return statement 2013-05-02 23:17:18 +02:00
Robert Krimen
6c5259a651 Add Object.toLocaleString 2013-05-02 21:06:22 +02:00
Robert Krimen
fb974ca5db Do not throw a TypeError when trying to set global, ignoreCase, source, etc. 2013-05-02 20:23:07 +02:00
Robert Krimen
596af0a836 Fix RegExp.prototype.toString .length & .prototype 2013-05-02 20:23:07 +02:00
Robert Krimen
bc84827b09 Fix RegExp.prototype.test .length & .prototype 2013-05-02 20:23:07 +02:00