leromarinvit
a813c59b1b
Fix Array.splice(n) with single argument ( #268 )
2017-08-18 09:51:46 +01:00
Alexander F Rødseth
ab54b0b8c6
Use -- instead of -= 1, as recommended by golint
2016-06-24 09:53:49 +02:00
xl1
c58b494b24
Fix buildinArray_sort
2016-04-30 03:13:39 +09:00
xl1
804a9102ab
Speed up builtinArray_sort for array with the same values
2016-04-24 04:52:56 +09:00
Robert Krimen
47082f4308
Look for less than 0, not just -1
...
This fixes #116
2015-06-10 22:48:44 -07:00
Robert Krimen
e6768252c2
Improve error reporting
...
* Delay entering global scope on code evaluation, not runtime creation
This fixes #66
2014-06-12 21:27:32 -07:00
Robert Krimen
709a0aa7ff
Value.string(), .float64(), .bool(), etc.
2014-06-06 21:29:40 -07:00
Robert Krimen
b813fe3676
Fix JSON.stringify treating large integers as float64
...
This fixes #80
2014-06-06 21:08:59 -07:00
Robert Krimen
918abeb8d8
The zero value of Value is now defined to be undefined
...
Previously, it was a publically accessible but invalid value (valueEmpty).
* Deprecate internal use of UndefinedValue(), NullValue(), FalseValue(), TrueValue()
* Guard against Empty, Result, Reference values from escaping the package
2014-05-28 21:23:32 -07:00
Robert Krimen
9cd045ef04
Simplification & refactor of (parts of) the runtime
...
* Proper lowercasing for internal stuff
* *Environment => *_stash
* ExecutionContext => _scope
* Simpler & shallower call/construct mechanics
* Remove unnecessary fields & methods
* Better scoping (no more stack): []*_scope => _scope.outer
* Some speed improvements
In preparation for #66
2014-05-27 22:05:35 -07:00
Robert Krimen
6f0e24ae2d
Fix Array.prototype.reduce, .reduceRight
...
Fix false-positives in underscore testing
Fix test (missing document because we're not in a browser)
2014-03-13 22:39:17 +01:00
Robert Krimen
56429ee75b
Fix placement of elements during Array.prototype.concat
...
Increase the index even if the element at the index does not exist
2014-01-24 21:20:22 -08:00
Robert Krimen
c8dbfa3536
Fix inadvertent stringification in Array.prototype.concat
2014-01-24 21:20:22 -08:00
Robert Krimen
3ed7305787
Fix NaN/+0/-0 comparison in Array.prototype.lastIndexOf
2014-01-24 21:20:22 -08:00
Robert Krimen
3ba06f003c
Fix NaN/+0/-0 comparison in Array.prototype.indexOf
2014-01-24 21:20:22 -08:00
Robert Krimen
81d91501f8
Handle non-numeric arguments to new Array properly
2014-01-22 20:30:10 -08:00
Robert Krimen
ca0a007083
RangeError if Array.length = 3.141, new Array(3.141), etc.
2013-08-11 14:59:31 -07:00
Robert Krimen
761b60eed6
Refine parts of builtin_array.go
2013-07-14 14:20:01 -07:00
Robert Krimen
40d01ced6e
Add Array.reduceRight (sdgoij)
2013-06-23 15:29:33 +02:00
Robert Krimen
1b70913ef7
Add Array.reduce (sdgoij)
2013-06-23 14:56:26 +02:00
Robert Krimen
bbc7992385
Add Array.filter (sdgoij)
2013-06-23 14:44:41 +02:00
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
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
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
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
0da0545485
Add Array.isArray
2013-04-17 11:05:32 -07:00
Robert Krimen
bf322e56ee
Fix subtle range bug in String.substring (uint => int64)
...
Was looking for negative in the following calculation:
uint(0) - uint(3) => uint(0)
2013-02-20 16:24:01 -08:00
Robert Krimen
ec902a6452
Split builtin.go out to builtin_*.go
2013-02-20 15:58:45 -08:00