fix missing Typed Expression for local and field variable
This commit is contained in:
parent
baf9362634
commit
2139e7832c
@ -48,8 +48,9 @@ typeCheckExpression (Reference id) symtab classes =
|
||||
in case classDetails of
|
||||
Just (Class _ _ fields) ->
|
||||
let fieldTypes = [dt | VariableDeclaration dt fieldId _ <- fields, fieldId == id]
|
||||
-- this case only happens when its a field of its own class so the implicit this will be converted to explicit this
|
||||
in case fieldTypes of
|
||||
[fieldType] -> TypedExpression fieldType (BinaryOperation NameResolution (LocalVariable "this") (FieldVariable id))
|
||||
[fieldType] -> TypedExpression fieldType (BinaryOperation NameResolution (TypedExpression className (LocalVariable "this")) (TypedExpression fieldType (FieldVariable id)))
|
||||
[] -> error $ "Field '" ++ id ++ "' not found in class '" ++ className ++ "'"
|
||||
_ -> error $ "Ambiguous reference to field '" ++ id ++ "' in class '" ++ className ++ "'"
|
||||
Nothing -> error $ "Class '" ++ className ++ "' not found for 'this'"
|
||||
|
Loading…
Reference in New Issue
Block a user