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

58 Commits

Author SHA1 Message Date
deoxxa
9ce459fe6b amend docs on Keys/KeysByParent 2016-04-28 22:44:27 +10:00
deoxxa
6e7c8df250 add KeysByParent function for recursively getting object keys 2016-04-27 16:08:07 +10:00
deoxxa
fd1eddd0f9 add support for an external Math.random() provider 2016-02-18 22:08:25 +11:00
Andrew Montgomery-Hurrell
45c7a8df39 Add Context method to aid debugging
This change introduces a Context method to otto that allows developers to get
information about the current execution context. The method returns a Context
struct that contains information such as the filename, line and column of the
current execution, the current value of this, the stacktrace and the available
symbols at the current context.
2015-12-05 18:03:36 +00:00
Conrad Pankoff
4a7676e51c Merge pull request #142 from deoxxa/add-debugger-hook
add a way to trigger something with `debugger`
2015-12-05 21:14:00 +11:00
deoxxa
44a4b3115d support and test Eval() without an existing scope 2015-12-05 20:24:12 +11:00
deoxxa
7f15b1724e add a way to trigger something with debugger 2015-12-05 19:25:33 +11:00
deoxxa
72211f7dbb add Eval() to execute code in the current vm scope 2015-12-05 19:05:21 +11: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
1a2fa0b815 Fix "Halting Problem" example
As discussed in #71, the original example contains a race condition that could cause the goroutine to block forever.
2014-05-31 13:38:11 -07:00
Robert Krimen
f09ce5eac2 Add mutex locking for .Copy() 2014-05-30 20:27:30 -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
6d506b4b2f Update documention to mention natto 2014-04-26 22:49:27 -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
7721396b67 Fix Date tests to always mock UTC 2014-04-13 15:07:29 -07:00
Robert Krimen
ddca88af9b Add compilation (Script, vm.Compile, etc.) 2014-04-13 15:04:32 -07:00
Robert Krimen
ba4c8b0769 Fix documentation 2014-04-11 18:23:34 -07:00
Robert Krimen
f04cfab02d Add ability to parse []byte, *bytes.Buffer, io.Reader 2014-04-11 18:07:57 -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
ec106f69e0 Add Object.Keys()
This fixes #62
2014-04-03 18:25:53 -07:00
Robert Krimen
70e6bec5e0 Make sure to set the Otto/runtime dependency when copying
This is a problem in #57
2014-02-16 21:22:30 -08:00
Robert Krimen
f0159cfec0 Add note about setTimeout/setInterval
This involves #53
2014-02-01 16:52:57 -08:00
Robert Krimen
096cd7e450 Add ability to interrupt the runtime
This fixes #12, #35
2014-02-01 15:49:17 -08:00
Robert Krimen
8cd34bce0a Fix groups.google.com link 2014-02-01 12:05:08 -08:00
Robert Krimen
4fc2e41b28 Add link to godoc.org
This fixes #52
2014-02-01 12:01:52 -08:00
Robert Krimen
ea621687a4 Add Otto.Copy() 2013-07-14 14:20:01 -07:00
Robert Krimen
d42dcb705e Fix documentation
This fixes #26
2013-06-09 18:58:24 -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
791a2c0c8e Add FunctionCall.Otto 2013-05-19 14:57:01 -07:00
Robert Krimen
699232d49a Consolidate run/runSafe into _runtime 2013-05-18 16:18:17 -07:00
Robert Krimen
7b0eac16f9 Add Number.toPrecision 2013-03-07 08:42:48 -08:00
Robert Krimen
e5f0da1420 Add Number.toExponential 2013-03-07 08:34:12 -08:00
Robert Krimen
2e7e3e17fd Add Number.toFixed 2013-03-07 08:22:23 -08:00
Robert Krimen
795cc4935d Add remarks about ToValue & Otto.ToValue 2013-02-04 10:41:17 -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
38f6d71ff2 Remove remarks about UTF-16 incompatibility 2013-01-27 10:29:57 -08:00
Robert Krimen
20d2e8bba6 gofmt
Ugh.
2013-01-25 09:59:42 -08:00
Robert Krimen
5b38b16e99 Add remark about vertical tab and \s 2012-11-07 16:00:32 -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
33d9cbf707 Add a few regular expression tests 2012-10-20 15:00:25 -07:00
Robert Krimen
2390419e97 Add backreferencing "test" :( 2012-10-20 13:57:13 -07:00
Robert Krimen
ed98144c35 Remarks on UTF-8/16 2012-10-17 11:54:04 -07:00
Robert Krimen
7dfbf6ab13 Better regular expression syntax checking
And a limitation elaboration
2012-10-12 18:55:41 -07:00
Robert Krimen
b6f8642fe2 Add note about regular expression limitation 2012-10-11 22:28:41 -07:00
Robert Krimen
02929cbeb1 Shortcut the production of Object.Value() 2012-10-11 18:22:00 -07:00
Robert Krimen
c57edbfe2b Alter Object.Call to be more in line with .Get, .Set 2012-10-11 17:57:51 -07:00
Robert Krimen
8fbfeead4b Correct import statement 2012-10-10 22:57:53 -07:00