Skip to content

Commit

Permalink
More specific interface calling fix
Browse files Browse the repository at this point in the history
  • Loading branch information
myitcv committed Aug 21, 2017
1 parent cc1df05 commit 1935fa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions compiler/expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,11 @@ func (c *funcContext) makeReceiver(e *ast.SelectorExpr) *expression {

_, isPointer := recvType.Underlying().(*types.Pointer)
methodsRecvType := sel.Obj().Type().(*types.Signature).Recv().Type()

if _, isInterface := methodsRecvType.Underlying().(*types.Interface); isInterface {
return c.formatExpr("$copyInterfaceVal(%e)", x)
}

_, pointerExpected := methodsRecvType.(*types.Pointer)
if !isPointer && pointerExpected {
recvType = types.NewPointer(recvType)
Expand All @@ -825,6 +830,7 @@ func (c *funcContext) makeReceiver(e *ast.SelectorExpr) *expression {
if isWrapped(recvType) {
recv = c.formatExpr("new %s(%s)", c.typeName(methodsRecvType), recv)
}

return recv
}

Expand Down Expand Up @@ -1112,12 +1118,6 @@ func (c *funcContext) translateImplicitConversion(expr ast.Expr, desiredType typ
}

exprType := c.p.TypeOf(expr)

// whenever expr has an underlying *types.Interface type we need to $copyInterfaceVal
if _, isIface := exprType.Underlying().(*types.Interface); isIface {
return c.formatExpr("$copyInterfaceVal(%e)", expr)
}

if types.Identical(exprType, desiredType) {
return c.translateExpr(expr)
}
Expand Down
1 change: 0 additions & 1 deletion tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ func runNode(script string, args []string, dir string, quiet bool) error {
}
// rlimit value is in bytes, we need rounded kBytes value per node --v8-options.
stackSize := fmt.Sprintf("--stack_size=%v", r.Cur/1000)

allArgs = append(allArgs, stackSize)
}

Expand Down

0 comments on commit 1935fa5

Please sign in to comment.