Skip to content

Commit ad455b6

Browse files
committed
Go 1.11.1 support (version bump to GopherJS 1.11-2).
Go 1.11.1 has been released recently. It includes some changes to the reflect package, including: - golang/go@a2f1c8e - golang/go@3afa9df - golang/go@58c9bd9 The second commit makes some changes to internal reflect code that makes GopherJS reflect overrides no longer compatible, causing the package to no longer build: $ gopherjs build reflect /usr/local/go/src/reflect/value.go:673:60: cannot use t (variable of type *rtype) as *funcType value in argument to funcLayout /usr/local/go/src/reflect/value.go:336:21: cannot use methodReceiver(op, v, int(v.flag) >> flagMethodShift) (value of type *rtype) as *funcType value in assignment Specifically, the type of return value t of function methodReceiver was changed from *rtype to *funcType in commit golang/go@3afa9df. This change updates the native reflect override for methodReceiver function and Value.call method accordingly. Regenerate natives with: go generate ./compiler/natives Use Go 1.11.1 in CI. Bump GopherJS version to GopherJS 1.11-2. Fixes #862.
1 parent 0210a2f commit ad455b6

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ machine:
66

77
dependencies:
88
pre:
9-
- cd /usr/local && sudo rm -rf go && curl https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz | sudo tar -xz && sudo chmod a+w go/src/path/filepath
9+
- cd /usr/local && sudo rm -rf go && curl https://storage.googleapis.com/golang/go1.11.1.linux-amd64.tar.gz | sudo tar -xz && sudo chmod a+w go/src/path/filepath
1010
post:
1111
- mv ./gopherjs $HOME/bin
1212
- npm install --global node-gyp

compiler/natives/fs_vfsdata.go

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/natives/src/reflect/reflect.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ func Copy(dst, src Value) int {
647647
return js.Global.Call("$copySlice", dstVal, srcVal).Int()
648648
}
649649

650-
func methodReceiver(op string, v Value, i int) (_, t *rtype, fn unsafe.Pointer) {
650+
func methodReceiver(op string, v Value, i int) (_ *rtype, t *funcType, fn unsafe.Pointer) {
651651
var prop string
652652
if v.typ.Kind() == Interface {
653653
tt := (*interfaceType)(unsafe.Pointer(v.typ))
@@ -658,7 +658,7 @@ func methodReceiver(op string, v Value, i int) (_, t *rtype, fn unsafe.Pointer)
658658
if !tt.nameOff(m.name).isExported() {
659659
panic("reflect: " + op + " of unexported method")
660660
}
661-
t = tt.typeOff(m.typ)
661+
t = (*funcType)(unsafe.Pointer(tt.typeOff(m.typ)))
662662
prop = tt.nameOff(m.name).name()
663663
} else {
664664
ms := v.typ.exportedMethods()
@@ -669,7 +669,7 @@ func methodReceiver(op string, v Value, i int) (_, t *rtype, fn unsafe.Pointer)
669669
if !v.typ.nameOff(m.name).isExported() {
670670
panic("reflect: " + op + " of unexported method")
671671
}
672-
t = v.typ.typeOff(m.mtyp)
672+
t = (*funcType)(unsafe.Pointer(v.typ.typeOff(m.mtyp)))
673673
prop = js.Global.Call("$methodSet", jsType(v.typ)).Index(i).Get("prop").String()
674674
}
675675
rcvr := v.object()
@@ -849,7 +849,7 @@ var callHelper = js.Global.Get("$call").Interface().(func(...interface{}) *js.Ob
849849

850850
func (v Value) call(op string, in []Value) []Value {
851851
var (
852-
t *rtype
852+
t *funcType
853853
fn unsafe.Pointer
854854
rcvr *js.Object
855855
)
@@ -860,7 +860,7 @@ func (v Value) call(op string, in []Value) []Value {
860860
rcvr = jsType(v.typ).New(rcvr)
861861
}
862862
} else {
863-
t = v.typ
863+
t = (*funcType)(unsafe.Pointer(v.typ))
864864
fn = unsafe.Pointer(v.object().Unsafe())
865865
rcvr = js.Undefined
866866
}

compiler/version_check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ package compiler
66
const ___GOPHERJS_REQUIRES_GO_VERSION_1_11___ = true
77

88
// Version is the GopherJS compiler version string.
9-
const Version = "1.11-1"
9+
const Version = "1.11-2"

0 commit comments

Comments
 (0)