Simplified compilation of function calls

This commit is contained in:
2025-03-02 21:36:23 +01:00
parent c3054369e3
commit ea233d789d
14 changed files with 114 additions and 97 deletions

View File

@ -59,19 +59,24 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
return value, nil
}
uniqueName := fmt.Sprintf("%s.%s", leftText, rightText)
function, exists := f.All.Functions[uniqueName]
if leftText != "main" {
imp, exists := f.File.Imports[leftText]
if exists {
f.File.Imports[leftText].Used = true
if exists {
imp.Used = true
} else {
_, exists := f.All.Extern[leftText]
value := &eval.Label{
Typ: types.AnyPointer,
Label: function.UniqueName,
if !exists {
return nil, errors.New(&errors.UnknownPackage{Name: leftText}, f.File, left.Token.Position)
}
}
return value, nil
}
return nil, errors.New(&errors.UnknownIdentifier{Name: uniqueName}, f.File, left.Token.Position)
value := &eval.Label{
Typ: types.AnyPointer,
Label: fmt.Sprintf("%s.%s", leftText, rightText),
}
return value, nil
}