You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The original issues used to work in k6 until the es6 merge at which point it stopped but it only works for []interface{} which is what happens when you just unmarshal an array from json (the original use case). Even before the es6 branch this didn't work for anything else, but I would argue that ... they should especially as if you access length it is obviously there.
A simple reproducible test
vm:=New()
s:= []interface{}{2, 3, 4}
vm.GlobalObject().Set("s", vm.ToValue(s))
fmt.Printf("%#v\n", vm.ToValue(s))
v, err:=vm.RunString(`s.hasOwnProperty("length")`)
iferr!=nil {
t.Fatal(err)
}
fmt.Println(v) // this should be true but it's false unless you go back to 1f8a2ffe986ff105e41a12cc8b82857c3e1c2d44
For the record this only works because this resolves to using objectGoSlice not objectGoSliceReflect, which also doesn't work. And no actual combination seems to work currently :(.
The text was updated successfully, but these errors were encountered:
…formats, ... (#47)
* Fixed typed arrays' defineProperty and indexing. Fixesdop251#308.
* Fix Proxy creation panicing on target not callable
* Do not modify sb for variadic calls as it breaks local variables resolution. Instead place a marker on stack and use it to count the number of args. Fixesdop251#311.
* Support patterns in catch clause. See dop251#305
* Fixed the handling of Symbol properties in destructuring assignments. Fixesdop251#312.
* Ensure ToPropertyKey happens earlier when assigning computed keys. Fixesdop251#312.
* Aligned detached buffer semantics with the latest specs. Fixesdop251#315.
* More typed arrays fixes
* Fixed accessor and property key function names. Fixesdop251#314.
* Fixed possible panic when sorting non-standard arrays.
* Added nil-safety checks for values returned by get*() methods
* Fixed panics in parser on some invalid inputs. Fixesdop251#318.
* Arrow function (dop251#319)
* Implemented arrow functions. See dop251#304.
* Define the name property for anonymous functions (including arrow functions)
* Treat "arguments" as a lexical binding to match the latest specification
* Allow arrow functions to contain 'use strict' for simple parameter lists. Fixesdop251#323.
* Fixed argument variable reference resolution in stashless functions
* Treat date-only formats as UTC and date-time as local timezone. Added support for additional datetime formats. Fixesdop251#281, fixesdop251#292.
* Use correct createArgsRest variant when arguments are not in stash. Fixesdop251#327
* Fixed formatting for go 1.17
* Report 'length' as own property for Go slices. Fixesdop251#328.
Original report to the k6 project.
The original issues used to work in k6 until the es6 merge at which point it stopped but it only works for
[]interface{}
which is what happens when you just unmarshal an array from json (the original use case). Even before the es6 branch this didn't work for anything else, but I would argue that ... they should especially as if you accesslength
it is obviously there.A simple reproducible test
For the record this only works because this resolves to using
objectGoSlice
notobjectGoSliceReflect
, which also doesn't work. And no actual combination seems to work currently :(.The text was updated successfully, but these errors were encountered: