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

24 Commits

Author SHA1 Message Date
Steven Hartland
af6c304c5a Merge pull request #107 from multiplay/call-params
Improve method call parameter processing
2015-12-01 13:14:24 +00:00
Steven Hartland
526e6b2be2 Merge pull request #106 from multiplay/float-precision
Prevent loss of float precision
2015-12-01 13:13:51 +00:00
Steven Hartland
e378501ad1 Merge pull request #108 from multiplay/array-types
Export arrays to common type if possible
2015-12-01 13:13:00 +00:00
Tim Cooper
d1b4d8ef0e Fix Go map iteration when looping over non-string keys 2015-03-01 16:44:54 -08:00
Steven Hartland
a30a6a7b53 Improve method call parameter processing
Add support for the final parameter to a variadic function to be a slice.

Add support for conversion of slice parameters.

Expand numeric conversion support to include all int and uint types as souce types. This allows the result of bitwise calculations (int32) to be passed in as parameters.
2015-02-19 11:45:35 +00:00
Steven Hartland
abcc601db6 Prevent loss of float precision
When automatically converting a float to int type ensure we don't loose any precision.
2015-02-19 11:33:21 +00:00
Steven Hartland
72d92c8e19 Export arrays to common type if possible
If there is a common type for all values in an array export to a slice of that type otherwise return a slice of interfaces.
2015-02-17 23:18:23 +00:00
Robert Krimen
c2346f4ada Merge pull request #103 from multiplay/multi-return
Support go multiple return values as an array
2015-02-15 16:28:43 -08:00
Steven Hartland
c25bb49761 Automatic numeric parameter conversion
Javascript uses int64 (literals) and float64 (default) representations for numbers so to allow easy use of go funcs apply automatic conversion for function parameters where it is safe to do so.
2015-02-12 15:48:45 +00:00
Steven Hartland
81b01b9fac Support go multiple return values as an array
Add support for go funcs which return multiple values by returning them as an array.

In the future this can be used along side destructuring assignment to provide a nice way to deal with multiple value returns e.g.
[val, err] = MyGoFunc()
2015-02-12 15:10:58 +00:00
Robert Krimen
6c7c425424 Fix toReflectValue to handle Struct, Map, Slice, etc.
This fixes #79
2014-06-04 18:08:42 -07:00
Robert Krimen
98be5e74da go vet
This fixes #76

I cheated on some of these.
2014-05-28 21:46:08 -07:00
Robert Krimen
ba678bc782 Use _runtime.toValue() instead of func toValue()
This fixes #72
2014-05-22 20:39:27 -07:00
Robert Krimen
470b8c3b73 terst
* Update to latest github.com/robertkrimen/terst
* Clean up testing
2014-04-25 22:48:25 -07:00
Robert Krimen
ad8a97c028 New parser
* Faster, more straightforward, etc.
* More advanced object literals (get ..., set ...)
* More tests using JavaScript from the wild (http://cdnjs.com/)
2014-04-10 20:42:25 -07:00
Daniel Cannon
07737f86b9 Add ability to call struct methods
This fixes #60

This is incompatible with go 1.0.3
2014-03-16 09:04:00 -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
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
9184233705 Bundle terst dependency (github.com/robertkrimen/terst) 2013-04-15 10:20:34 -07:00
Robert Krimen
15aadd333c Upgrade underscore to 1.4.4, including tests 2013-02-04 21:58:47 -08:00
Robert Krimen
a879744c20 Add Go <=> JavaScript type interaction
Via reflection for struct, map, and slice/array
Fix #10
2013-02-04 10:31:44 -08:00