Inject ambient context into Go calls
This commit is contained in:
parent
acb42a5702
commit
5085ae51aa
8 changed files with 112 additions and 9 deletions
|
|
@ -1217,6 +1217,12 @@ func (g *goGenerator) expr(expr Expr, expectedType string) (string, error) {
|
|||
}
|
||||
args = append([]string{g.currentCoroutineScope}, args...)
|
||||
}
|
||||
if call, ok := resolvedCall.Node.(HIRGoCall); ok && call.InjectContext {
|
||||
if g.currentCoroutineScope == "" {
|
||||
return "", fmt.Errorf("Go function requires an ambient coroutine context")
|
||||
}
|
||||
args = append([]string{g.currentCoroutineScope + ".Context()"}, args...)
|
||||
}
|
||||
}
|
||||
callee, err := g.expr(e.Callee, "")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue