From da4f9622815f2f96acc2f28865395e1cd5bd25ac Mon Sep 17 00:00:00 2001 From: ahmad Date: Sat, 11 May 2024 13:53:21 +0200 Subject: [PATCH] Update the typeCheck of methods TypedAssignment --- .../de/maishai/typedast/typedclass/TypedAssignment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedAssignment.java b/src/main/java/de/maishai/typedast/typedclass/TypedAssignment.java index c41eca8..faca568 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedAssignment.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedAssignment.java @@ -35,7 +35,12 @@ public class TypedAssignment implements TypedStatement { if (!localVar.containsKey(varName)) { if(clas.isThereField(varName)){ typeLeft = clas.getFieldType(varName); - }else { + }else if(clas.isParameterWitNameInMethod(varName)) { + typeLeft = clas.getParameterTypeInCurrentMethod(varName); + }else if(clas.isParameterNameInCurrentConstructor(varName)) { + typeLeft = clas.getParameterTypeInCurrentConstructor(varName); + } + else{ throw new RuntimeException("Variable not declared"); } } else {