From 1b8ed72dff04c1edcb1dddfbd46223a9fc2ed1c5 Mon Sep 17 00:00:00 2001 From: ahmad Date: Sat, 11 May 2024 11:48:41 +0200 Subject: [PATCH] Renamed method name --- .../java/de/maishai/typedast/Util/TypedExpressionUtil.java | 2 +- .../java/de/maishai/typedast/typedclass/TypedBlock.java | 4 ++-- .../de/maishai/typedast/typedclass/TypedConstructor.java | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/maishai/typedast/Util/TypedExpressionUtil.java b/src/main/java/de/maishai/typedast/Util/TypedExpressionUtil.java index 305affe..b9d849e 100644 --- a/src/main/java/de/maishai/typedast/Util/TypedExpressionUtil.java +++ b/src/main/java/de/maishai/typedast/Util/TypedExpressionUtil.java @@ -11,7 +11,7 @@ public class TypedExpressionUtil { public static TypedExpression getKindOfExpression(Map localVar, TypedClass clas, Expression expression) { if (expression instanceof BoolLiteral boolLiteral) { - return new TypedBoolLiteral(boolLiteral.value()); + return new TypedBoolLiteral(localVar, clas, boolLiteral); } else if (expression instanceof CharLiteral charLiteral) { return new TypedCharLiteral(localVar, clas, charLiteral); diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java b/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java index 06d4ebc..94d0b72 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedBlock.java @@ -22,14 +22,14 @@ public class TypedBlock implements TypedNode { public TypedBlock(Map localVar, TypedClass clas, Block unTypedBlock) { - blockToTypedBlock(localVar, clas, unTypedBlock); + convertToTypedBlock(localVar, clas, unTypedBlock); } public TypedBlock(List vars, List stmts) { this.vars = vars; this.stmts = stmts; } - public void blockToTypedBlock(Map localVar, TypedClass clas, Block unTypedBlock) { + public void convertToTypedBlock(Map localVar, TypedClass clas, Block unTypedBlock) { if(unTypedBlock == null) { return; diff --git a/src/main/java/de/maishai/typedast/typedclass/TypedConstructor.java b/src/main/java/de/maishai/typedast/typedclass/TypedConstructor.java index 098126c..c8e12de 100644 --- a/src/main/java/de/maishai/typedast/typedclass/TypedConstructor.java +++ b/src/main/java/de/maishai/typedast/typedclass/TypedConstructor.java @@ -1,7 +1,6 @@ package de.maishai.typedast.typedclass; import de.maishai.ast.records.Constructor; -import de.maishai.ast.records.Node; import de.maishai.ast.records.Parameter; import de.maishai.typedast.CodeGenUtils; import de.maishai.typedast.MethodContext; @@ -28,14 +27,14 @@ public class TypedConstructor implements TypedNode { private TypedBlock typedBlock; public TypedConstructor(Map localVar, TypedClass clas, Constructor unTypedConstructor) { - constructorToTypedConstructor(localVar, clas, unTypedConstructor); + convertToTypedConstructor(localVar, clas, unTypedConstructor); } - public void constructorToTypedConstructor(Map localVar, TypedClass clas, Constructor unTypedConstructor) { + public void convertToTypedConstructor(Map localVar, TypedClass clas, Constructor unTypedConstructor) { name = unTypedConstructor.className(); for (Parameter param : unTypedConstructor.params()) { - typedParameters.add(new TypedParameter(param.name(), param.type())); + typedParameters.add(new TypedParameter(localVar, clas, param)); } }