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

741 Commits

Author SHA1 Message Date
leromarinvit
a813c59b1b Fix Array.splice(n) with single argument (#268) 2017-08-18 09:51:46 +01:00
Archis
fc2eb1bbf1 Added functional benchmarks (#255)
This change adds two types of tests:
1. First some regular Test* tests that functionally
ensure the test cases are correct.

2. A few Benchmark* tests that then allow us to
measure Otto's performance under various functional scenarios.

The basic tests are just sorting, but I'm planning over time
to bring in more advanced tests (like the CryptoAES) from
popular benchmarking suites (JetStream for instance.)

I intend to run profiler on these tests to find any
ottlenecks or low-hanging fruit that can help speed up
Otto for real-world use-cases.

Next up after this is to add some heavy underscorejs
benchmarks.

Responding to PR comments
2017-07-21 20:43:36 +01:00
Eddy Reyes
50ed21f88e Walk/Visitor should follow Enter/Exit Pattern (#258)
* (#257) Change Walk/Visit to follow an explicit Enter/Exit pattern

* (#257) Convert walk example into test.

* (#257) restore walk/visitor example

* (#257) Fix godoc comment in the Visitor interface

... typo referred to `End` method instead of `Exit`
2017-07-21 20:42:34 +01:00
Olivier Poitrey
49fee9c1c0 Add a an ast.Walk utility function (#250) 2017-06-04 11:36:02 +01:00
Archis
e1afcee0b0 Other methods callable on Maps (#254)
Background:

When methods are attached on a map type like so:
type Foo map[string]string

func (f Foo) Bar() {
	fmt.Printf("Hello World");
}

vm := otto.New();

vm.Set("foo", Foo{});
vm.Run(`
    foo.Bar();
`);

You get:
Error in Run: TypeError: 'Bar' is not a function

The Fix:

I looked into how/why the same works for arrays. After
all array properties are tested (such as length, and any integer-based members),
the code then looks for any methods attached to that type.

This change literally copies that code over into
maps.

This is very useful when working with the http.Request object which
has the http.Header type that is a map[string][]string, with a lot
of useful methods attached to it.

Added unit test to support/guard the change (and map had no test before)

Responded to PR comments
2017-06-02 10:05:44 +01:00
Wael Nasreddine
bc4cd51799 ast: ThisExpression.Idx1() should point to the end of this (#251) 2017-06-02 10:04:14 +01:00
Vincent Vanackere
21ec96599b Fix bug in runtime when exporting null|undefined to interface{} (#244) 2017-04-24 11:46:44 +01:00
Steven Hartland
1861f2408b Merge pull request #238 from veonik/no-rel-imports
Replaced './terst' relative import with qualified name.
2017-03-08 08:57:57 +00:00
Tyler Sommer
9c716adcc8 Replaced './terst' relative import with qualified name. 2017-03-07 11:15:29 -07:00
Steven Hartland
6a77b7cbc3 Merge pull request #228 from dsnet/master
Fix Test_issue80 on Go 1.8
2017-02-05 01:36:59 +00:00
Steven Hartland
20a18bbe27 Merge pull request #235 from k2wanko/fix-typo-readme
Fix typo in README
2017-02-05 01:35:47 +00:00
Robert Krimen
1c73769694 -gxc 2017-01-21 16:43:39 -08:00
Robert Krimen
c28cc513ff Merge pull request #233 from sstone1/master
Handle []uint16 to boolean conversion (resolves #232)
2017-01-21 16:34:08 -08:00
Kazuhiro Kubota
5caa170cde Fix typo 2017-01-18 17:37:52 +09:00
Robert Krimen
284b08b295 Restore .split returning a proper Array (fix #234) 2017-01-13 18:35:26 -08:00
Robert Krimen
87e059e861 Fix for S15.1.2.3_A2_T10 2017-01-12 16:21:41 -08:00
Robert Krimen
e314343b47 Fix for S15.1.2.2_A2_T10 2017-01-12 16:15:58 -08:00
Robert Krimen
54e1705423 Fix for S9.3.1_A2 2017-01-12 15:54:54 -08:00
Simon Stone
7a965dd45d Handle []uint16 to boolean conversion (resolves #232) 2016-11-24 16:28:05 +00:00
Joe Tsai
41bb429a2c Fix Test_issue80 on Go 1.8
An upstream change (http://golang.org/cl/30371) makes the Go encoder
to be more compliant with the ES6 standard. Ironically, this change
causes Test_issue80 to fail on the larger number ranges.

To make this test work on both Go 1.7 and Go 1.8, we delete the larger
value tests, which are arguably locking in the wrong behavior.
2016-11-08 13:23:43 -08:00
Conrad Pankoff
bf1c3795ba Merge pull request #219 from budadcabrion/master
fix for casting GoArrays on in convertCallParameter
2016-10-04 23:49:59 +11:00
Conrad Pankoff
bda76a056f Merge pull request #218 from dhiltonp/fastsplit
made string splits *much* faster
2016-10-04 23:46:47 +11:00
Conrad Pankoff
d5ddea59ff Merge pull request #211 from yohanbelleguic/fix-example
readme: fix "twoPlus" example function
2016-10-04 23:45:46 +11:00
jan-karl
d93f9dce58 test illustrating the issue 2016-10-01 02:50:38 -04:00
jan-karl
ea095c6386 fix for casting GoArrays on in convertCallParameter 2016-10-01 02:31:40 -04:00
David P Hilton
8b169d526d adjusted benchmark style to match call_test.go, added benchmarks for all regex-related functions. 2016-09-24 15:29:50 -06:00
David P Hilton
5bc6a83c93 added string split benchmark 2016-09-22 15:50:54 -06:00
David P Hilton
7427d59429 made string splits *much* faster 2016-09-22 14:52:38 -06:00
Conrad Pankoff
3e7ca9f192 Merge pull request #216 from hochhaus/master
Document that otto targets ES5
2016-09-19 11:00:42 +10:00
Andy Hochhaus
29f673c4d2 Document that otto targets ES5 2016-09-18 17:59:18 -07:00
Yohan BELLEGUIC
51bbfc0656 readme: fix "twoPlus" example function 2016-08-10 14:37:35 +02:00
Conrad Pankoff
7d9cbc2bef Merge pull request #210 from gagliardetto/patch-2
Add missing code highlighting
2016-07-29 08:04:12 +10:00
Slavomir
5bd804b3a8 Add missing code highlighting 2016-07-28 22:02:30 +02:00
Steven Hartland
c41cf547e0 Merge pull request #204 from xyproto/master
Only minor changes
2016-06-24 10:21:23 +01:00
Alexander F Rødseth
ab54b0b8c6 Use -- instead of -= 1, as recommended by golint 2016-06-24 09:53:49 +02:00
Alexander F Rødseth
e3f7ae2533 Consistent use of "value Value"/"vl Value" 2016-06-24 09:53:47 +02:00
Alexander F Rødseth
e2ef7653d2 Make it clearer that inline is a Perl script 2016-06-24 09:53:43 +02:00
Alexander F Rødseth
2a4ac54b0e Remove executable bit from source file 2016-06-24 09:53:35 +02:00
Conrad Pankoff
e1fe9ec568 Merge pull request #203 from uppfinnarn/newerror-nil-dereference
Fix for #202
2016-06-21 21:51:53 +10:00
uppfinnarn
cb827c7f40 Fix for #202 2016-06-21 13:49:50 +02:00
uppfinnarn
a87f62d034 Failing test for #202 2016-06-21 13:48:49 +02:00
Conrad Pankoff
610cd3ae86 Merge pull request #198 from deoxxa/fix-calling-go-functions-with-gostruct-arguments
fix calling go functions with goStructObject arguments
2016-05-30 13:32:50 +10:00
deoxxa
9597787793 fix calling go functions with goStructObject arguments 2016-05-30 13:30:33 +10:00
Conrad Pankoff
ef5bb303cc Merge pull request #192 from deoxxa/support-inline-source-maps
add support for inline source maps
2016-05-11 10:14:34 +10:00
deoxxa
99d478d5e8 add support for inline source maps 2016-05-08 21:17:26 +10:00
Conrad Pankoff
c562e464c6 Merge pull request #191 from deoxxa/implement-configurable-stack-trace-limit
implement configurable stack trace limit
2016-05-08 18:17:07 +10:00
deoxxa
b6c6f18e54 ensure we clone all required runtime properties 2016-05-08 18:13:57 +10:00
deoxxa
ccf93984d9 implement configurable stack trace limit 2016-05-08 18:13:57 +10:00
Conrad Pankoff
96f57ba9bb Merge pull request #190 from deoxxa/refactor-native-function-parameter-conversion
refactor native function parameter conversion
2016-05-08 10:38:42 +10:00
deoxxa
1fe0007dcb refactor native function parameter conversion
* add benchmarks and tests for native function calls
* improve conversion of various native function parameters
* add support for more types of native function parameters
* improve performance of most parameter types
2016-05-07 21:35:17 +10:00