SyntaxTreeGenerator.setPackageName() is now used properly.

This commit is contained in:
Jakob Herrmann 2017-02-07 22:12:40 +01:00
parent 8d0f24f2f8
commit 50a618ee4b
2 changed files with 7 additions and 5 deletions

View File

@ -27,7 +27,7 @@ public class RunParser{
SyntaxTreeGenerator generator = new SyntaxTreeGenerator(new JavaClassRegistry());
SourceFile f = generator.convert((Java8Parser.CompilationUnitContext) tree);
String pkgName = f.getPkgName();
System.out.println(pkgName);
System.out.println("package: " + pkgName);
System.out.println("classes:");
for(ClassOrInterface c : f.KlassenVektor){
for(Modifier mod : c.getModifiers().getModifierList()){

View File

@ -34,11 +34,12 @@ public class SyntaxTreeGenerator{
}
public void getNames(Java8Parser.CompilationUnitContext ctx){
if(this.pkgName == "") this.setPackageName(ctx);
String nameString = "";
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
if(typeDecl.interfaceDeclaration() != null){
if(typeDecl.interfaceDeclaration().normalInterfaceDeclaration() != null){
if(this.pkgName != null){
if(this.pkgName != ""){
nameString = this.pkgName + "." + typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
}
else{
@ -134,8 +135,9 @@ public class SyntaxTreeGenerator{
RefType retType;
if(header.result() != null){
if(header.result().unannType() != null)
if(header.result().unannType() != null){
retType = convert(header.result().unannType());
}
else retType = new de.dhbwstuttgart.syntaxtree.type.Void(header.result().getStart());
}else{
retType = TypePlaceholder.fresh(header.getStart());