Improved implementation of assign operators

This commit is contained in:
2025-03-01 11:34:36 +01:00
parent c1427eb7f6
commit 6c0ab72f8f
5 changed files with 81 additions and 130 deletions

View File

@ -20,7 +20,14 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
variable := f.VariableByName(leftText)
if variable != nil {
field := variable.Value.Typ.(*types.Pointer).To.(*types.Struct).FieldByName(rightText)
f.UseVariable(variable)
pointer := variable.Value.Typ.(*types.Pointer)
structure := pointer.To.(*types.Struct)
field := structure.FieldByName(rightText)
if field == nil {
return nil, errors.New(&errors.UnknownStructField{StructName: structure.Name(), FieldName: rightText}, f.File, right.Token.Position)
}
value := eval.Memory{
Typ: field.Type,