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

34 Commits

Author SHA1 Message Date
Conrad Pankoff
a0b60d71e6 Merge pull request #112 from emicklei/master
Issue #81 add CallerLocation to FunctionCall
2015-12-01 15:18:58 +11:00
Dmitry Panov
1e5ee63535 Fixed stacktrace positions. 2015-04-01 21:03:24 +01:00
Ernest Micklei
9919b73823 add CallerLocation to FunctionCall 2015-03-01 08:49:14 +01: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
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
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
Tim Jurcka
dd88ce83b8 Call getter/setter if property is AccessorDescriptor
This fixes #36
This fixes #56
2014-02-12 21:52:42 -08:00
Tim Jurcka
5fe23327c9 Add JSON
This closes #37, #11
2014-02-01 11:32:21 -08:00
Robert Krimen
21cd663185 Allow .bind to bind [[Construct]] 2014-01-20 18:04:34 -08:00
Robert Krimen
73b83020ce Add caller and arguments properties to functions via .bind 2014-01-20 13:25:41 -08:00
Robert Krimen
2d6125ee2c Fix .length property of functions via .bind 2014-01-20 12:58:00 -08:00
Robert Krimen
4860ef573b Fix Function.bind to use newBoundFunction...
...instead of newBoundFunctionObject

Basically, newBoundFunctionObject returns an incomplete object (without a prototype, __prototype__, etc.)
2014-01-20 08:27:19 -08:00
Robert Krimen
4c1bc5857b Fix documentation (nikai3d)
This fixes #45

The errors are manifest in the README, but this is automatically generated from the go documentation, so we have to fix them at the source
2014-01-19 10:52:14 -08:00
Robert Krimen
ea621687a4 Add Otto.Copy() 2013-07-14 14:20:01 -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
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
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
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
2ec9b0843c eval is not a constructor 2013-04-28 11:29:20 +02:00
Robert Krimen
8d09167814 HasInstance should only exist on a Function 2013-04-20 21:41:00 -07:00
Robert Krimen
2642607a58 Fix HasInstance to recurse the prototype hierarchy 2013-04-20 20:03:34 -07:00
Robert Krimen
299495ba0a Set callee property of Arguments object 2013-03-05 09:08:46 -08:00
Robert Krimen
fef122900f Add Function.bind 2013-03-01 13:08:10 -08:00
Robert Krimen
16a30ee951 Differentiate between direct and indirect eval 2013-02-27 21:23:21 -08:00
Robert Krimen
aaa90bf65c Fix HasInstace (instanceof) to return false
Should not TypeError panic on a non-Object
2013-02-04 15:21:00 -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
Robert Krimen
20d2e8bba6 gofmt
Ugh.
2013-01-25 09:59:42 -08: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
c1a21812fe Fix trying to call a non-function as a function 2012-10-22 14:29:14 -07:00
Robert Krimen
4a8c7ffc00 Initial commit 2012-10-05 18:47:53 -07:00