Preserve Gotlin semantics across packages

This commit is contained in:
pavel 2026-08-27 22:18:45 +02:00
commit acb42a5702
10 changed files with 525 additions and 34 deletions

View file

@ -590,6 +590,11 @@ func (resolver *semanticResolver) meaning(expr Expr, scope *Scope) (ExprMeaning,
return MappingExpression, nil
}
if receiver, ok := selector.Receiver.(IdentExpr); ok {
if pack := resolver.program.Packages[receiver.Name]; pack != nil {
if function := pack.Function(selector.Name); function != nil {
return GotlinCallExpr, function
}
}
if receiver.Name == "Result" {
return EnumConstructionExpr, nil
}
@ -601,7 +606,7 @@ func (resolver *semanticResolver) meaning(expr Expr, scope *Scope) (ExprMeaning,
return GoCallExpr, nil
}
if class, _ := classInstance(ResolvedType(selector.Receiver)); class != nil {
if method, ok := class.Methods[selector.Name]; ok {
if method := class.Method(selector.Name); method != nil {
return MethodCallExpr, method
}
}