diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedFieldVarAccess.java b/src/main/java/de/maishai/typedast/typedclass/TypedFieldVarAccess.java index 3b29ade..d7d5b36 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedFieldVarAccess.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedFieldVarAccess.java @@ -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");