This commit is contained in:
Fayez Abu Alia 2018-01-31 15:55:02 +01:00
parent 398c1992fa
commit 56d919f446
4 changed files with 11 additions and 9 deletions

View File

@ -181,7 +181,7 @@ public class BytecodeGen implements ASTVisitor {
Signature signature = new Signature(method, genericsAndBoundsMethod, methodParamsAndTypes,resultSet);
sig = signature.toString();
}
System.out.println(sig);
NormalMethod meth = new NormalMethod(method,genericsAndBounds,genericsAndBoundsMethod,hasGen);
methDesc = meth.accept(new DescriptorToString(resultSet));
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC+acc, method.getName(), methDesc, sig, null);

View File

@ -31,6 +31,7 @@ import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
import de.dhbwstuttgart.syntaxtree.statement.literal.BoolLiteral;
import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
import de.dhbwstuttgart.syntaxtree.statement.literal.Null;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
@ -420,8 +421,8 @@ public class BytecodeGenMethod implements StatementVisitor{
@Override
public void visit(WhileStmt whileStmt) {
// TODO Auto-generated method stub
whileStmt.expr.accept(this);
whileStmt.loopBlock.accept(this);
}
@Override
@ -437,7 +438,6 @@ public class BytecodeGenMethod implements StatementVisitor{
@Override
public void visit(Literal literal) {
// value?
mv.visitLdcInsn(getResolvedType(literal.getType()));
}

View File

@ -48,9 +48,11 @@ public class DescriptorToString implements DescriptorVisitor{
}else {
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
}
}else if(((RefType) fp.getType()).getParaList().size() > 0){
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "%").replace("<", "%%").replace(">", "%%")+ ";";
}else {
}
// else if(((RefType) fp.getType()).getParaList().size() > 0){
// desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "%").replace("<", "%%").replace(">", "%%")+ ";";
// }
else {
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
}
}

View File

@ -25,9 +25,9 @@ public class TypeToSignature implements TypeVisitor<String> {
params += "L"+param.toString().replace(".", "/");
if(it.hasNext())params += ";";
}
params += ";>;";
params += ";>";
}
return refType.getName().toString().replace(".", "/") + params;
return refType.getName().toString().replace(".", "/") + params+";";
}
@Override