Inject ambient context into Go calls

This commit is contained in:
pavel 2026-08-27 22:31:10 +02:00
commit 5085ae51aa
8 changed files with 112 additions and 9 deletions

View file

@ -46,8 +46,11 @@ type HIRReference struct{ Target *Symbol }
func (HIRReference) hirNode() {}
type HIRGoCall struct {
Callee *HIRExpr
Result Type
Callee *HIRExpr
Result Type
Params []Type
Variadic bool
InjectContext bool
}
func (HIRGoCall) hirNode() {}
@ -498,7 +501,8 @@ func (resolver *semanticResolver) hirNode(expr Expr, semantic *HIRExpr) HIRNode
return HIRReference{Target: semantic.Symbol}
case GoCallExpr:
if call, ok := expr.(CallExpr); ok {
return HIRGoCall{Callee: exprMeta(call.Callee), Result: semantic.Type}
signature, _ := resolver.program.goCallSignature(call)
return HIRGoCall{Callee: exprMeta(call.Callee), Result: semantic.Type, Params: signature.Params, Variadic: signature.Variadic, InjectContext: shouldInjectCoroutineContext(call, signature)}
}
case GotlinCallExpr, MethodCallExpr:
return HIRGotlinCall{Target: semantic.Symbol, Result: semantic.Type}