Skip to content

Commit 2d2b586

Browse files
committed
Non-pointer unboxing.
1 parent 55aef3e commit 2d2b586

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/gopherjs/translator/expressions.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,10 @@ func (c *PkgContext) translateExpr(expr ast.Expr) string {
621621
return c.translateExpr(e.X)
622622
}
623623
t := c.info.Types[e.Type]
624+
_, isStruct := t.Underlying().(*types.Struct)
624625
check := c.typeCheck("Go$typeOf(Go$obj)", t)
625626
value := "Go$obj"
626-
if isWrapped(t) {
627+
if isWrapped(t) || isStruct {
627628
value += ".v"
628629
}
629630
if _, isTuple := exprType.(*types.Tuple); isTuple {

src/gopherjs/translator/statements.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ func (c *PkgContext) translateStmt(stmt ast.Stmt, label string) {
9191
}
9292
value := refVar
9393
if len(conds) == 1 {
94-
if isWrapped(c.info.Types[conds[0]]) {
94+
t := c.info.Types[conds[0]]
95+
_, isStruct := t.Underlying().(*types.Struct)
96+
if isWrapped(t) || isStruct {
9597
value += ".v"
9698
}
9799
}

0 commit comments

Comments
 (0)