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

39 Commits

Author SHA1 Message Date
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
98be5e74da go vet
This fixes #76

I cheated on some of these.
2014-05-28 21:46:08 -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
bf7b16f4a3 Add internal compilation step
* Streamline what we get from "otto/parser"
* Get rid of some "otto/parser" cruft
* FunctionExpression => FunctionLiteral
* The debugger statement (debugger) should do nothing (not panic)
* Fix aspects of function expression call evaluation
2014-04-19 14:05:51 -07:00
Robert Krimen
029f0bbd63 Fix parseInt if ErrRange occurs (fallback to float64) 2014-04-11 18:05:54 -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
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
4c85422172 Make encodeURI correspond to the 15.1.3.3 algorithm and encodeURIComponent ito 15.1.3.4 2013-05-02 20:23:06 +02:00
Robert Krimen
83d4565b22 Make decodeURI correspond to the 15.1.3.1 algorithm and decodeURIComponent ito 15.1.3.2 2013-05-02 20:23:06 +02:00
Robert Krimen
16030f4b6f Make parseInt behavior correspond to the 15.1.2.3 algorithm 2013-04-30 00:18:00 +02:00
Robert Krimen
b5e40f8a85 Make parseInt behavior correspond to the 15.1.2.2 algorithm 2013-04-28 17:33:00 +02:00
Robert Krimen
8486fe2d1c Add escape/unescape 2013-03-17 22:06:08 -07:00
Robert Krimen
260b2a48bf Fix (band-aid) Go/JavaScript cross-boundary error transformation 2013-03-06 12:07:26 -08:00
Robert Krimen
16a30ee951 Differentiate between direct and indirect eval 2013-02-27 21:23:21 -08:00
Robert Krimen
ec902a6452 Split builtin.go out to builtin_*.go 2013-02-20 15:58:45 -08:00
Robert Krimen
4e4e89c894 Fix bug in String.slice with a (go) slice bounds violation
Basically, check that start is less than length before trying
to take a slice.

Also, rename valueToArrayIndex to valueToRangeIndex to reflect
the fact that it does not always return a value that is valid
index (value could be length)
2013-02-20 15:58:43 -08:00
Robert Krimen
ae1fa3daef Fix indexOf to use safer _toInteger 2013-02-19 17:14:34 -08:00
Robert Krimen
bdaa00884d toU16/U32/I32 => toUint16/Uint32/Int32 2013-02-18 15:58:48 -08:00
Robert Krimen
20d2e8bba6 gofmt
Ugh.
2013-01-25 09:59:42 -08:00
Robert Krimen
aef569f297 Fix to handle Infinity radix in parseInt properly 2012-11-15 15:15:26 -08:00
Robert Krimen
9385f32241 Fix substring to have correct behavior 2012-11-06 20:03:22 -08:00
Robert Krimen
491805071f Add toPropertyDescriptor, Object.getOwnPropertyDescriptor 2012-10-27 14:18:07 -07:00
Robert Krimen
9d6d2638c1 Move toPropertyDescriptor into property.go 2012-10-27 13:22:58 -07:00
Robert Krimen
42233ac62f Add Object.create, Object.defineProperties 2012-10-27 09:48:11 -07:00
Robert Krimen
6f5ca7cc0d Beef up _property, remove _defineProperty
Remove uneeded _valueProperty
Rename to propertyMode_{write,enumerate,configure}
.Can* => writeable, enumerable, configureable
Privatize _property
Get rid of _defineProperty
2012-10-27 08:59:38 -07:00
Robert Krimen
b6f98935d4 Add Object.defineProperty( ... ) 2012-10-26 16:34:34 -07:00
Robert Krimen
3c93384f5c Cleanup of stash, property, and object
Use octal to designate write/enumerate/configure (experimental)
Move extensibility responsibility into the stash
Rename propertyStash => objectStash (be congruent with arrayStash, etc.)
Get rid of a bunch of useless methods
Privatize everything ([A-Z] => [a-z_])
gofmt
2012-10-26 15:47:19 -07:00
Robert Krimen
f842eda638 Add a String.substr implementation
This will fix #6
2012-10-19 13:26:22 -07:00
Robert Krimen
2a1b3aaaca Add rudimentary Math.pow builtin 2012-10-18 11:30:45 -07:00
Robert Krimen
24e71588dd Add String.fromCharCode 2012-10-18 10:58:23 -07:00
Robert Krimen
474a473e36 Convert _syntaxError to SyntaxError (eval) 2012-10-17 10:27:22 -07:00
Robert Krimen
32cbffe7b8 Avoid backing up when checking for line terminator 2012-10-17 01:05:52 -07:00
Robert Krimen
235c19bd71 Substitute undefined for failed captures in String.replace
When String.replace(...) is called with a replacement function.
Again, similar to the scenario in #2.
2012-10-14 22:50:17 -07:00
Robert Krimen
b718c5ec2a Handle missing captures gracefully in String.replace
This is related to #2
2012-10-14 22:33:22 -07:00
Robert Krimen
ff5fc43690 Add Date.toUTCString 2012-10-07 23:05:15 -07:00
Robert Krimen
fa0f2abc44 Use new date adjustment technique 2012-10-07 22:54:39 -07:00
Robert Krimen
4a8c7ffc00 Initial commit 2012-10-05 18:47:53 -07:00