Improved type system
This commit is contained in:
@ -144,10 +144,6 @@ func (f *Function) ExpressionToRegister(node *expression.Expression, register cp
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if typ == types.AnyPointer && right.Token.Kind == token.Identifier && f.VariableByName(right.Token.Text(f.File.Bytes)).Type == types.AnyPointer {
|
||||
typ = types.Int
|
||||
}
|
||||
|
||||
err = f.Execute(node.Token, register, right)
|
||||
|
||||
if register != final {
|
||||
@ -155,5 +151,17 @@ func (f *Function) ExpressionToRegister(node *expression.Expression, register cp
|
||||
f.FreeRegister(register)
|
||||
}
|
||||
|
||||
_, isArray := typ.(*types.Array)
|
||||
|
||||
if isArray {
|
||||
typ = types.AnyPointer
|
||||
} else if right.Token.Kind == token.Identifier {
|
||||
rightVariable := f.VariableByName(right.Token.Text(f.File.Bytes))
|
||||
|
||||
if typ == types.AnyPointer && rightVariable.Type == types.AnyPointer {
|
||||
typ = types.Int
|
||||
}
|
||||
}
|
||||
|
||||
return typ, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user