Renamed method name

This commit is contained in:
ahmad 2024-05-11 11:48:41 +02:00
parent f40318f905
commit 1b8ed72dff
3 changed files with 6 additions and 7 deletions

View File

@ -11,7 +11,7 @@ public class TypedExpressionUtil {
public static TypedExpression getKindOfExpression(Map<String, Type> localVar, TypedClass clas, Expression expression) { public static TypedExpression getKindOfExpression(Map<String, Type> localVar, TypedClass clas, Expression expression) {
if (expression instanceof BoolLiteral boolLiteral) { if (expression instanceof BoolLiteral boolLiteral) {
return new TypedBoolLiteral(boolLiteral.value()); return new TypedBoolLiteral(localVar, clas, boolLiteral);
} }
else if (expression instanceof CharLiteral charLiteral) { else if (expression instanceof CharLiteral charLiteral) {
return new TypedCharLiteral(localVar, clas, charLiteral); return new TypedCharLiteral(localVar, clas, charLiteral);

View File

@ -22,14 +22,14 @@ public class TypedBlock implements TypedNode {
public TypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) { public TypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
blockToTypedBlock(localVar, clas, unTypedBlock); convertToTypedBlock(localVar, clas, unTypedBlock);
} }
public TypedBlock(List<TypedLocalVariable> vars, List<TypedStatement> stmts) { public TypedBlock(List<TypedLocalVariable> vars, List<TypedStatement> stmts) {
this.vars = vars; this.vars = vars;
this.stmts = stmts; this.stmts = stmts;
} }
public void blockToTypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) { public void convertToTypedBlock(Map<String, Type> localVar, TypedClass clas, Block unTypedBlock) {
if(unTypedBlock == null) { if(unTypedBlock == null) {
return; return;

View File

@ -1,7 +1,6 @@
package de.maishai.typedast.typedclass; package de.maishai.typedast.typedclass;
import de.maishai.ast.records.Constructor; import de.maishai.ast.records.Constructor;
import de.maishai.ast.records.Node;
import de.maishai.ast.records.Parameter; import de.maishai.ast.records.Parameter;
import de.maishai.typedast.CodeGenUtils; import de.maishai.typedast.CodeGenUtils;
import de.maishai.typedast.MethodContext; import de.maishai.typedast.MethodContext;
@ -28,14 +27,14 @@ public class TypedConstructor implements TypedNode {
private TypedBlock typedBlock; private TypedBlock typedBlock;
public TypedConstructor(Map<String, Type> localVar, TypedClass clas, Constructor unTypedConstructor) { public TypedConstructor(Map<String, Type> localVar, TypedClass clas, Constructor unTypedConstructor) {
constructorToTypedConstructor(localVar, clas, unTypedConstructor); convertToTypedConstructor(localVar, clas, unTypedConstructor);
} }
public void constructorToTypedConstructor(Map<String, Type> localVar, TypedClass clas, Constructor unTypedConstructor) { public void convertToTypedConstructor(Map<String, Type> localVar, TypedClass clas, Constructor unTypedConstructor) {
name = unTypedConstructor.className(); name = unTypedConstructor.className();
for (Parameter param : unTypedConstructor.params()) { for (Parameter param : unTypedConstructor.params()) {
typedParameters.add(new TypedParameter(param.name(), param.type())); typedParameters.add(new TypedParameter(localVar, clas, param));
} }
} }