Fehler im Parsen von Typen mit Package Namen behoben
This commit is contained in:
parent
8759a9cc5d
commit
1e037a0019
@ -104,7 +104,17 @@ public class TypeGenerator {
|
|||||||
|
|
||||||
private static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.ClassOrInterfaceTypeContext classOrInterfaceTypeContext, JavaClassRegistry reg, GenericsRegistry generics) {
|
private static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.ClassOrInterfaceTypeContext classOrInterfaceTypeContext, JavaClassRegistry reg, GenericsRegistry generics) {
|
||||||
Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx = classOrInterfaceTypeContext.classType_lfno_classOrInterfaceType();
|
Java8Parser.ClassType_lfno_classOrInterfaceTypeContext ctx = classOrInterfaceTypeContext.classType_lfno_classOrInterfaceType();
|
||||||
return convertTypeName(ctx.Identifier().toString(), ctx.typeArguments(),classOrInterfaceTypeContext.getStart(), reg, generics);
|
if(ctx.typeArguments() != null &&
|
||||||
|
classOrInterfaceTypeContext.classType_lf_classOrInterfaceType().size() > 0)
|
||||||
|
throw new NotImplementedException();
|
||||||
|
String typeName = ctx.Identifier().toString();
|
||||||
|
Java8Parser.ClassType_lf_classOrInterfaceTypeContext nextCtx = null;
|
||||||
|
for(Java8Parser.ClassType_lf_classOrInterfaceTypeContext forEachCtx : classOrInterfaceTypeContext.classType_lf_classOrInterfaceType()){
|
||||||
|
nextCtx = forEachCtx;
|
||||||
|
typeName += "." + forEachCtx.Identifier().toString();
|
||||||
|
}
|
||||||
|
Java8Parser.TypeArgumentsContext arguments = nextCtx!=null?nextCtx.typeArguments():ctx.typeArguments();
|
||||||
|
return convertTypeName(typeName, arguments, classOrInterfaceTypeContext.getStart(), reg, generics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.InterfaceTypeContext interfaceTypeContext) {
|
private static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.InterfaceTypeContext interfaceTypeContext) {
|
||||||
|
@ -109,7 +109,6 @@ classOrInterfaceType
|
|||||||
| interfaceType_lfno_classOrInterfaceType
|
| interfaceType_lfno_classOrInterfaceType
|
||||||
)
|
)
|
||||||
( classType_lf_classOrInterfaceType
|
( classType_lf_classOrInterfaceType
|
||||||
| interfaceType_lf_classOrInterfaceType
|
|
||||||
)*
|
)*
|
||||||
;
|
;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,12 +5,12 @@ class Faculty {
|
|||||||
m () {
|
m () {
|
||||||
|
|
||||||
var fact = (Integer x) -> {
|
var fact = (Integer x) -> {
|
||||||
//if (x == 1) {
|
if (x == 1) {
|
||||||
return x;
|
return x;
|
||||||
//}
|
}
|
||||||
//else {
|
else {
|
||||||
//return x * (fact.apply(x-1));
|
return x * (fact.apply(x-1));
|
||||||
//}
|
}
|
||||||
};
|
};
|
||||||
return fact;
|
return fact;
|
||||||
}
|
}
|
||||||
|
17
test/javFiles/FacultyIf.jav
Normal file
17
test/javFiles/FacultyIf.jav
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import java.lang.Integer;
|
||||||
|
|
||||||
|
class Faculty {
|
||||||
|
|
||||||
|
m () {
|
||||||
|
|
||||||
|
var fact = (Integer x) -> {
|
||||||
|
if (x == 1) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return x * (fact.apply(x-1));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return fact;
|
||||||
|
}
|
||||||
|
}
|
@ -61,6 +61,10 @@ public class JavaTXCompilerTest {
|
|||||||
execute(new File(rootDirectory+"Faculty.jav"));
|
execute(new File(rootDirectory+"Faculty.jav"));
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
|
public void facultyIf() throws IOException, ClassNotFoundException {
|
||||||
|
execute(new File(rootDirectory+"FacultyIf.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
public void facultyTyped() throws IOException, ClassNotFoundException {
|
public void facultyTyped() throws IOException, ClassNotFoundException {
|
||||||
execute(new File(rootDirectory+"FacultyTyped.jav"));
|
execute(new File(rootDirectory+"FacultyTyped.jav"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user