update typeCheck of TypedFieldVarAccess

This commit is contained in:
ahmad 2024-05-15 17:59:16 +02:00
parent aaa8a27ff9
commit 7979aece64

View File

@ -52,6 +52,9 @@ public class TypedFieldVarAccess implements TypedExpression {
} else if(typedProgram.getCurrentClass().isThereField(name)){
type = typedProgram.getCurrentClass().getFieldType(name);
return type;
} else if(recursiveOwnerChain instanceof TypedFieldVarAccess typedFieldVarAccess){
type = typedProgram.getCurrentClass().getFieldType(typedFieldVarAccess.getName());
return type;
}
else {
throw new RuntimeException("Variable " + name + " not declared in constructor");
@ -67,6 +70,9 @@ public class TypedFieldVarAccess implements TypedExpression {
} else if(typedProgram.getCurrentClass().isThereField(name)){
type = typedProgram.getCurrentClass().getFieldType(name);
return type;
} else if(recursiveOwnerChain instanceof TypedFieldVarAccess typedFieldVarAccess){
type = typedProgram.getCurrentClass().getFieldType(typedFieldVarAccess.getName());
return type;
}
else {
throw new RuntimeException("Variable " + name + " not declared in method");