mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 17:08:03 +00:00
Update the typeCheck in TypedFieldVarAccess
This commit is contained in:
parent
de51bcd825
commit
8b5ec63e4b
@ -40,28 +40,34 @@ public class TypedFieldVarAccess implements TypedExpression {
|
|||||||
throw new RuntimeException("Field " + name + " not declared ");
|
throw new RuntimeException("Field " + name + " not declared ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (clas.isThereField(name)) {
|
if (clas.isCurrentConstructorPresent()) {
|
||||||
type = clas.getFieldType(name);
|
|
||||||
return type;
|
|
||||||
} else if (clas.isCurrentConstructorPresent()) {
|
|
||||||
if (clas.isParameterNameInCurrentConstructor(name)) {
|
if (clas.isParameterNameInCurrentConstructor(name)) {
|
||||||
type = clas.getParameterTypeInCurrentConstructor(name);
|
type = clas.getParameterTypeInCurrentConstructor(name);
|
||||||
return type;
|
return type;
|
||||||
} else if (clas.getCurrentConstructor().isLocalVariablePresent(name)) {
|
} else if (clas.getCurrentConstructor().isLocalVariablePresent(name)) {
|
||||||
type = clas.getCurrentConstructor().getLocalVariableType(name);
|
type = clas.getCurrentConstructor().getLocalVariableType(name);
|
||||||
return type;
|
return type;
|
||||||
} else {
|
} else if(clas.isThereField(name)){
|
||||||
throw new RuntimeException("Variable " + name + " not declared ");
|
type = clas.getFieldType(name);
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new RuntimeException("Variable " + name + " not declared in constructor");
|
||||||
|
}
|
||||||
|
|
||||||
} else if (clas.isCurrentMethodPresent()) {
|
} else if (clas.isCurrentMethodPresent()) {
|
||||||
if (clas.isParameterWitNameInMethod(name)) {
|
if (clas.isParameterWitNameInMethod(name)) {
|
||||||
type = clas.getParameterTypeInCurrentMethod(name);
|
type = clas.getParameterTypeInCurrentMethod(name);
|
||||||
return clas.getParameterTypeInCurrentMethod(name);
|
return type;
|
||||||
} else if (clas.getCurrentMethod().isLocalVariablePresent(name)) {
|
} else if (clas.getCurrentMethod().isLocalVariablePresent(name)) {
|
||||||
type = clas.getCurrentMethod().getLocalVariableType(name);
|
type = clas.getCurrentMethod().getLocalVariableType(name);
|
||||||
return type;
|
return type;
|
||||||
} else {
|
} else if(clas.isThereField(name)){
|
||||||
throw new RuntimeException("Variable " + name + " not declared ");
|
type = clas.getFieldType(name);
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new RuntimeException("Variable " + name + " not declared in method");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Variable " + name + " not declared ");
|
throw new RuntimeException("Variable " + name + " not declared ");
|
||||||
|
Loading…
Reference in New Issue
Block a user