deoxxa
c03dfd35cd
support the non-standard Error.stack property
...
Popular runtimes (V8[1], SpiderMonkey[2], IE[3]) support a `stack`
property on Error objects to get the error's stack as a string.
This change adds support to otto for this same feature. It's implemented
in a similar way to V8, using a getter function. This avoids generating
the stack trace (which is done in a loop with string manipulation etc)
unless the user requests it. There's no standard, or even trend, for the
actual _content_ of `stack`, so we basically just copy what V8's traces
look like.
[1]: https://github.com/v8/v8/wiki/Stack%20Trace%20API
[2]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Error/stack
[3]: http://msdn.microsoft.com/en-us/library/windows/apps/hh699850.aspx
2016-05-02 19:22:56 +10:00
Conrad Pankoff
3b7f285a92
Merge pull request #181 from deoxxa/add-error-creator-functions
...
add error creator functions
2016-05-02 19:21:39 +10:00
Conrad Pankoff
4c50a9dc04
Merge pull request #173 from xl1/improve-array-sort
...
Improve performance to sort array with the same values
2016-04-30 15:22:05 +10:00
deoxxa
a7e69fb1ca
add error creator functions
...
This change adds a handful of functions to `otto.Otto` type that make
it easier to create proper `Error` values from native code. Previously,
the only way to do this was to call the error's constructor from
JavaScript like `vm.Call("TypeError", "message")`. `Call` can fail for
various reasons, and also modifies the current call stack.
These new functions can't fail, and since they don't involve any
JavaScript execution, won't modify the call stack. The new functions
are:
* `MakeCustomError(name, message string) Value`
* `MakeRangeError(message string) Value`
* `MakeSyntaxError(message string) Value`
* `MakeTypeError(message string) Value`
`MakeCustomError` creates an `Error` object with a specific `name` value.
The other functions cover some common error types, and call specific
functions in the runtime to construct errors with the correct prototypes.
If we need to implement any other error types, it'll mostly be copy/paste.
2016-04-30 12:45:33 +10:00
xl1
c58b494b24
Fix buildinArray_sort
2016-04-30 03:13:39 +09:00
xl1
dab050291b
Add tests for Array sort
2016-04-30 03:12:46 +09:00
deoxxa
9ce459fe6b
amend docs on Keys/KeysByParent
2016-04-28 22:44:27 +10:00
deoxxa
03de7d5c8c
make autocomplete an opt-in repl feature
2016-04-28 22:43:16 +10:00
Conrad Pankoff
d1eaa4b5e9
Merge pull request #168 from deoxxa/limit-stack-depth
...
add simple stack depth limit mechanism
2016-04-27 20:10:23 +10:00
Conrad Pankoff
e1cb3011d0
Merge pull request #169 from deoxxa/fix-crash-exporting-array
...
fixes #165 - crash exporting an array with undefined as the first element
2016-04-27 20:09:46 +10:00
Conrad Pankoff
e214185093
Merge pull request #151 from Fugiman/master
...
Have goSliceGetOwnProperty check methods as well
2016-04-27 17:07:52 +10:00
Fugiman
3b5f2fda57
Add test for go slice methods
2016-04-27 00:02:57 -07:00
Chris Gamble
8f5d15d409
Have goSliceGetOwnProperty check methods as well
2016-04-27 00:02:56 -07:00
deoxxa
c3d9ea142b
add tab-complete to repl
2016-04-27 16:08:41 +10:00
deoxxa
6e7c8df250
add KeysByParent function for recursively getting object keys
2016-04-27 16:08:07 +10:00
Conrad Pankoff
b283580aea
Merge pull request #164 from wolfgarnet/commentmapv2
...
Commentmapv2
2016-04-25 16:16:03 +10:00
Conrad Pankoff
445ff6b9d0
Merge pull request #174 from amasad/master
...
Export NewParser and Parser.Scan
2016-04-25 16:06:10 +10:00
Amjad Masad
cb833c2321
Expose Parser Interface with a Scan method
2016-04-24 23:01:26 -07:00
deoxxa
f271e0183c
don't try to construct a common type array if there is no type
2016-04-25 11:58:49 +10:00
deoxxa
8dcf49dfe7
amend type sniffing to work with null
2016-04-25 11:58:30 +10:00
deoxxa
8e3ecbc5e3
avoid scope depth check for first stack frame
2016-04-25 11:39:17 +10:00
deoxxa
655561815b
document SetStackDepthLimit tests
2016-04-25 11:36:59 +10:00
deoxxa
029a80224c
document SetStackDepthLimit
2016-04-25 11:36:52 +10:00
xl1
804a9102ab
Speed up builtinArray_sort for array with the same values
2016-04-24 04:52:56 +09:00
Steven Hartland
c619b8fa10
Merge pull request #172 from dop251/remove-redundant-rangeerror-prefixes-fix-tests
...
Fixed tests to match the updated error messages.
2016-04-05 23:39:28 +01:00
Dmitry Panov
25c2e92cec
Fixed tests to match the updated error messages.
2016-04-05 19:10:38 +01:00
Steven Hartland
6c92cd134a
Merge pull request #170 from deoxxa/remove-redundant-rangeerror-prefixes
...
remove redundant RangeError prefixes
2016-04-03 16:17:44 +01:00
deoxxa
17aaeb85c3
remove redundant RangeError prefixes
2016-04-04 00:34:33 +10:00
deoxxa
014e1807a9
remove redundant unnecessary error prefix
2016-04-04 00:32:44 +10:00
deoxxa
da054efc5f
fixes #165 - crash exporting an array with undefined as the first element
2016-04-04 00:25:24 +10:00
deoxxa
c142472392
add simple stack depth limit mechanism
2016-04-04 00:07:41 +10:00
wolfgarnet
ab433a4a50
Improved comment map
...
* More precise
* Line break special cases supported
* Less intrusive
2016-02-22 15:16:41 +01:00
wolfgarnet
1003ce01cb
DotExpression identifier as pointer
2016-02-19 13:15:14 +01:00
wolfgarnet
3b2178bf55
Added FunctionStatement
2016-02-19 13:14:42 +01:00
Conrad Pankoff
53221230c2
Merge pull request #149 from wolfgarnet/commentmap
...
Storing comments in a commentmap
2016-02-19 09:43:13 +11:00
Conrad Pankoff
9c8301a8b3
Merge pull request #163 from deoxxa/external-random-source
...
add support for an external Math.random() provider
2016-02-18 22:10:03 +11:00
deoxxa
fd1eddd0f9
add support for an external Math.random() provider
2016-02-18 22:08:25 +11:00
Steven Hartland
c21072f61b
Merge pull request #157 from kazhuravlev/patch-1
...
Fix example
2016-01-29 12:10:11 +00:00
kazhuravlev
2bebd7b731
Fix example
2016-01-29 14:15:00 +03:00
Christian Wolfgang
d65b096ff3
[ #148 ] Fixed style in lexer
2016-01-17 20:08:44 +01:00
wolfgarnet
54a2be367f
[ #148 ] Fixed style
2016-01-12 12:13:04 +01:00
wolfgarnet
9f65b62899
[ #148 ] Grouped statements
2016-01-12 11:14:02 +01:00
wolfgarnet
c356c94888
[ #148 ] Do not make context switch if not necessary
2016-01-12 11:02:09 +01:00
wolfgarnet
8cd2f8fd93
[ #148 ] Added test parser to set mode
2016-01-12 10:17:29 +01:00
wolfgarnet
3903251f9a
[ #148 ] Updated lexer unit tests
2016-01-12 10:16:25 +01:00
wolfgarnet
6d8bdc96fd
[ #148 ] Added mode to store comments
2016-01-12 10:15:49 +01:00
wolfgarnet
fa2636115f
Added parser benchmark
2016-01-11 14:07:31 +01:00
wolfgarnet
f304d96c25
[ #148 ] Including disabled tests
2016-01-11 09:22:15 +01:00
wolfgarnet
09ad467104
[ #148 ] Lower cased errors
2016-01-11 09:20:14 +01:00
wolfgarnet
36da11f822
[ #148 ] Removed temporary comment variables
2016-01-11 09:16:46 +01:00