TypeInsert ausbessern

This commit is contained in:
JanUlrich 2017-08-25 03:39:54 +02:00
parent 397ac3cd58
commit ff59b585bd
4 changed files with 14 additions and 10 deletions

View File

@ -63,7 +63,8 @@ public abstract class AbstractASTWalker implements ASTVisitor{
private void visitMethod(Method method){
method.getType().accept(this);
method.getParameterList().accept(this);
method.block.accept(this);
if(method.block != null)
method.block.accept(this);
}
@Override

View File

@ -84,7 +84,8 @@ public class OutputGenerator implements ASTVisitor {
method.getType().accept(this);
out.append(" " + method.getName());
method.getParameterList().accept(this);
method.block.accept(this);
if(method.block != null)
method.block.accept(this);
out.append("\n");
}

View File

@ -62,6 +62,8 @@ public class TypeInsertFactory {
additionalInserts.add(((TypePlaceholder) type));
}else if(type instanceof GenericRefType){
insertPoint = new TypeInsertPoint(offset, ((GenericRefType) type).getName().toString());
}else if(type instanceof RefType){
insertPoint = new TypeInsertPoint(offset, ((RefType) type).getName().toString());
}else throw new NotImplementedException();
}

View File

@ -33,15 +33,15 @@ public class JavaTXCompilerTest extends JavaTXCompiler {
@Test
public void test() throws IOException, java.lang.ClassNotFoundException {
//filesToTest.add(new File(rootDirectory+"Faculty.jav"));
filesToTest.add(new File(rootDirectory+"Faculty.jav"));
filesToTest.add(new File(rootDirectory+"mathStruc.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
//filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
//filesToTest.add(new File(rootDirectory+"Vector.jav"));
//filesToTest.add(new File(rootDirectory+"Generics.jav"));
//filesToTest.add(new File(rootDirectory+"MethodsEasy.jav"));
//filesToTest.add(new File(rootDirectory+"Matrix.jav"));
filesToTest.add(new File(rootDirectory+"Lambda.jav"));
filesToTest.add(new File(rootDirectory+"Lambda2.jav"));
filesToTest.add(new File(rootDirectory+"Lambda3.jav"));
filesToTest.add(new File(rootDirectory+"Vector.jav"));
filesToTest.add(new File(rootDirectory+"Generics.jav"));
filesToTest.add(new File(rootDirectory+"MethodsEasy.jav"));
filesToTest.add(new File(rootDirectory+"Matrix.jav"));
for(File f : filesToTest){
SourceFile sf = this.parse(f);
System.out.println(ASTTypePrinter.print(this.sourceFiles.get(sourceFiles.size()-1)));