Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update goja to from 9037c2b to 4418d45 #2524

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/PuerkitoBio/goquery v1.8.0
github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5
github.com/andybalholm/brotli v1.0.4
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf
github.com/dop251/goja v0.0.0-20220516123900-4418d4575a41
github.com/fatih/color v1.13.0
github.com/golang/protobuf v1.5.2
github.com/gorilla/websocket v1.5.0
Expand Down
13 changes: 10 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 h1:Izz0+t1Z5nI16/II7vuEo/nHjodOg0p7+OiDpjX5t1E=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf h1:Yt+4K30SdjOkRoRRm3vYNQgR+/ZIy0RmeUDZo7Y8zeQ=
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk=
github.com/dop251/goja v0.0.0-20220516123900-4418d4575a41 h1:yRPjAkkuR/E/tsVG7QmhzEeEtD3P2yllxsT1/ftURb0=
github.com/dop251/goja v0.0.0-20220516123900-4418d4575a41/go.mod h1:TQJQ+ZNyFVvUtUEtCZxBhfWiH7RJqR3EivNmvD6Waik=
github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y=
github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down Expand Up @@ -92,8 +94,9 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF
github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A=
github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down Expand Up @@ -127,6 +130,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE=
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
Expand Down Expand Up @@ -249,9 +254,11 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/guregu/null.v3 v3.3.0 h1:8j3ggqq+NgKt/O7mbFVUFKUMWN+l1AmT5jQmJ6nPh2c=
gopkg.in/guregu/null.v3 v3.3.0/go.mod h1:E4tX2Qe3h7QdL+uZ3a0vqvYwKQsRSQKM5V4YltdgH9Y=
Expand Down
2 changes: 1 addition & 1 deletion js/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var (
// "transform-regenerator", // Doesn't really work unless regeneratorRuntime is also added

// es2016 https://github.com/babel/babel/blob/v6.26.0/packages/babel-preset-es2016/src/index.js
"transform-exponentiation-operator",
// "transform-exponentiation-operator",

// es2017 https://github.com/babel/babel/blob/v6.26.0/packages/babel-preset-es2017/src/index.js
// "syntax-trailing-function-commas", // in goja
Expand Down
12 changes: 8 additions & 4 deletions js/compiler/compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ func TestCompile(t *testing.T) {
t.Parallel()
c := New(testutils.NewLogger(t))
c.Options.CompatibilityMode = lib.CompatibilityModeExtended
pgm, code, err := c.Compile(`3**2`, "script.js", true)
pgm, code, err := c.Compile(`class A {nine(){return 9}}; new A().nine()`, "script.js", true)
require.NoError(t, err)
assert.Equal(t, `"use strict";Math.pow(3, 2);`, code)
assert.Equal(t, `"use strict";var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}let A = function () {function A() {_classCallCheck(this, A);}_createClass(A, [{ key: "nine", value: function nine() {return 9;} }]);return A;}();;new A().nine();`,
code)
v, err := goja.New().RunProgram(pgm)
if assert.NoError(t, err) {
assert.Equal(t, int64(9), v.Export())
Expand All @@ -146,9 +147,12 @@ func TestCompile(t *testing.T) {
t.Parallel()
c := New(testutils.NewLogger(t))
c.Options.CompatibilityMode = lib.CompatibilityModeExtended
pgm, code, err := c.Compile(`exports.fn(3**2)`, "script.js", false)
pgm, code, err := c.Compile(`class A {nine(){return 9}}; exports.fn(new A().nine())`, "script.js", false)
require.NoError(t, err)
assert.Equal(t, "(function(module, exports){\n\"use strict\";exports.fn(Math.pow(3, 2));\n})\n", code)
assert.Equal(t, `(function(module, exports){
"use strict";var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}let A = function () {function A() {_classCallCheck(this, A);}_createClass(A, [{ key: "nine", value: function nine() {return 9;} }]);return A;}();;exports.fn(new A().nine());
})
`, code)
rt := goja.New()
v, err := rt.RunProgram(pgm)
if assert.NoError(t, err) {
Expand Down
2 changes: 0 additions & 2 deletions js/tc39/breaking_test_errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"test/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js-strict:true": "test/annexB/built-ins/RegExp/RegExp-leading-escape-BMP.js: Test262Error: Code unit: d800 Expected SameValue(«\\\\\\ud800», «\\�») to be true <at omitted>",
"test/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js-strict:true": "test/annexB/built-ins/RegExp/RegExp-trailing-escape-BMP.js: Test262Error: Code unit: d800 Expected SameValue(«a\\\\\\ud800», «a\\�») to be true <at omitted>",
"test/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js-strict:true": "test/annexB/built-ins/RegExp/prototype/compile/pattern-string-invalid-u.js: Test262Error: invalid pattern: { Expected a SyntaxError to be thrown but no exception was thrown at all <at omitted>",
"test/built-ins/Array/prototype/reverse/length-exceeding-integer-limit-with-proxy.js-strict:true": "test/built-ins/Array/prototype/reverse/length-exceeding-integer-limit-with-proxy.js: Test262Error: Expected [Get:length, Get:0, Get:9007199254740990, Set:0, GetOwnPropertyDescriptor:0, DefineProperty:0, Set:9007199254740990, GetOwnPropertyDescriptor:9007199254740990, DefineProperty:9007199254740990, Get:1, Get:9007199254740989, Set:1, GetOwnPropertyDescriptor:1, DefineProperty:1, Set:9007199254740989, GetOwnPropertyDescriptor:9007199254740989, DefineProperty:9007199254740989, Get:2, Get:9007199254740988, Set:2, GetOwnPropertyDescriptor:2, DefineProperty:2, Set:9007199254740988, GetOwnPropertyDescriptor:9007199254740988, DefineProperty:9007199254740988, Get:3, Get:9007199254740987, Set:3, GetOwnPropertyDescriptor:3, DefineProperty:3, Set:9007199254740987, GetOwnPropertyDescriptor:9007199254740987, DefineProperty:9007199254740987, Get:4] and [Get:length, Has:0, Get:0, Has:9007199254740990, Get:9007199254740990, Set:0, GetOwnPropertyDescriptor:0, DefineProperty:0, Set:9007199254740990, GetOwnPropertyDescriptor:9007199254740990, DefineProperty:9007199254740990, Has:1, Has:9007199254740989, Has:2, Get:2, Has:9007199254740988, Delete:2, Set:9007199254740988, GetOwnPropertyDescriptor:9007199254740988, DefineProperty:9007199254740988, Has:3, Has:9007199254740987, Get:9007199254740987, Set:3, GetOwnPropertyDescriptor:3, DefineProperty:3, Delete:9007199254740987, Has:4, Get:4] to have the same contents. The value of traps is expected to be [\n // Initial get length operation.\n \"Get:length\",\n\n // Lower and upper index are both present.\n \"Has:0\",\n \"Get:0\",\n \"Has:9007199254740990\",\n \"Get:9007199254740990\",\n \"Set:0\",\n \"GetOwnPropertyDescriptor:0\",\n \"DefineProperty:0\",\n \"Set:9007199254740990\",\n \"GetOwnPropertyDescriptor:9007199254740990\",\n \"DefineProperty:9007199254740990\",\n\n // Lower and upper index are both absent.\n \"Has:1\",\n \"Has:9007199254740989\",\n\n // Lower index is present, upper index is absent.\n \"Has:2\",\n \"Get:2\",\n \"Has:9007199254740988\",\n \"Delete:2\",\n \"Set:9007199254740988\",\n \"GetOwnPropertyDescriptor:9007199254740988\",\n \"DefineProperty:9007199254740988\",\n\n // Lower index is absent, upper index is present.\n \"Has:3\",\n \"Has:9007199254740987\",\n \"Get:9007199254740987\",\n \"Set:3\",\n \"GetOwnPropertyDescriptor:3\",\n \"DefineProperty:3\",\n \"Delete:9007199254740987\",\n\n // Stop exception.\n \"Has:4\",\n \"Get:4\",\n] <at omitted>",
"test/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js-strict:true": "test/built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js: TypeError: Constructor DataView requires 'new' <at omitted>",
"test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js-strict:true": "test/built-ins/ArrayBuffer/isView/arg-is-typedarray-subclass-instance.js: TypeError: Constructor TypedArray requires 'new' (Testing with Float64Array.) <at omitted>",
"test/built-ins/Date/UTC/fp-evaluation-order.js-strict:true": "test/built-ins/Date/UTC/fp-evaluation-order.js: Test262Error: order of operations / precision in MakeTime Expected SameValue(«29256», «29312») to be true <at omitted>",
Expand Down Expand Up @@ -962,7 +961,6 @@
"test/language/expressions/new.target/value-via-super-call.js-strict:true": "test/language/expressions/new.target/value-via-super-call.js: Test262Error: within \"parent\" constructor Expected SameValue(«undefined», «function Child() {_classCallCheck(this, Child);return _possibleConstructorReturn(this, (Child.__proto__ || Object.getPrototypeOf(Child)).call(this));\n\n }») to be true <at omitted>",
"test/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js-strict:true": "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js: test/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js: Line 29:4 Malformed arrow function parameter list (and 6 more errors)",
"test/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js-strict:true": "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js: SyntaxError: test/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js: await is a reserved word (30:3)\n 28 | \n 29 | let o = {\n> 30 | [await 9]: 9\n | ^\n 31 | };\n 32 | \n 33 | assert.sameValue( <at omitted>",
"test/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js-strict:true": "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js: SyntaxError: test/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js: Unexpected token (30:6)\n 28 | \n 29 | let o = {\n> 30 | [x ?? 1]: 2\n | ^\n 31 | };\n 32 | \n 33 | assert.sameValue( <at omitted>",
"test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js-strict:true": "test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js: SyntaxError: test/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js: Identifier directly after number (29:4)\n 27 | \n 28 | let o = {\n> 29 | [1_2_3_4_5_6_7_8]: 1_2_3_4_5_6_7_8\n | ^\n 30 | };\n 31 | \n 32 | assert.sameValue( <at omitted>",
"test/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js-strict:true": "test/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js: Test262Error: Expected SameValue(«_class», «cls») to be true <at omitted>",
"test/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js-strict:true": "test/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js: Test262Error: Expected SameValue(«_class», «cls») to be true <at omitted>",
Expand Down
87 changes: 60 additions & 27 deletions vendor/github.com/dop251/goja/builtin_array.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading