Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
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
4 changes: 2 additions & 2 deletions compiler/expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ func (fc *funcContext) translateCall(e *ast.CallExpr, sig *types.Signature, fun
// where we need to compute function and its arguments at the the keyword site,
// but the call itself will happen elsewhere (hence "delegated").
//
// Built-in functions and cetrain `js.Object` methods don't translate into JS
// Built-in functions and certain `js.Object` methods don't translate into JS
// function calls, and need to be wrapped before they can be delegated, which
// this function handles and returns JS expressions that are safe to delegate
// and behave like a regular JS function and a list of its argument values.
Expand Down Expand Up @@ -885,7 +885,7 @@ func (fc *funcContext) delegatedCall(expr *ast.CallExpr) (callable *expression,
Args: callArgs,
Ellipsis: expr.Ellipsis,
}
callable = fc.formatExpr("function(%s) { %e; }", strings.Join(vars, ", "), wrapper)
callable = fc.formatExpr("function(%s) { $stackDepthOffset--; %e; }", strings.Join(vars, ", "), wrapper)
arglist = fc.formatExpr("[%s]", strings.Join(args, ", "))
return callable, arglist
}
Expand Down