Improved implementation of assign operators

This commit is contained in:
Eduard Urbach 2025-03-01 11:34:36 +01:00
parent 485efe5727
commit a27b8efb36
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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,