Implemented Value interface
This commit is contained in:
@ -20,13 +20,12 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
|
||||
variable := f.VariableByName(leftText)
|
||||
|
||||
if variable != nil {
|
||||
field := variable.Type.(*types.Pointer).To.(*types.Struct).FieldByName(rightText)
|
||||
field := variable.Value.Typ.(*types.Pointer).To.(*types.Struct).FieldByName(rightText)
|
||||
|
||||
value := eval.Value{
|
||||
Kind: eval.Memory,
|
||||
Type: field.Type,
|
||||
value := eval.Memory{
|
||||
Typ: field.Type,
|
||||
Memory: asm.Memory{
|
||||
Base: variable.Register,
|
||||
Base: variable.Value.Register,
|
||||
Offset: int8(field.Offset),
|
||||
OffsetRegister: math.MaxUint8,
|
||||
Length: byte(field.Type.Size()),
|
||||
@ -42,12 +41,11 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
|
||||
number, err := ToNumber(constant.Token, constant.File)
|
||||
|
||||
if err != nil {
|
||||
return eval.Value{}, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
value := eval.Value{
|
||||
Kind: eval.Number,
|
||||
Type: types.AnyInt,
|
||||
value := eval.Number{
|
||||
Typ: types.AnyInt,
|
||||
Number: number,
|
||||
}
|
||||
|
||||
@ -60,14 +58,13 @@ func (f *Function) EvaluateDot(expr *expression.Expression) (eval.Value, error)
|
||||
if exists {
|
||||
f.File.Imports[leftText].Used = true
|
||||
|
||||
value := eval.Value{
|
||||
Kind: eval.Label,
|
||||
Type: types.AnyPointer,
|
||||
value := eval.Label{
|
||||
Typ: types.AnyPointer,
|
||||
Label: function.UniqueName,
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
return eval.Value{}, errors.New(&errors.UnknownIdentifier{Name: uniqueName}, f.File, left.Token.Position)
|
||||
return nil, errors.New(&errors.UnknownIdentifier{Name: uniqueName}, f.File, left.Token.Position)
|
||||
}
|
||||
|
Reference in New Issue
Block a user