forked from JavaTX/JavaCompilerCore
Umbau des StatementGenerators fortgeführt
This commit is contained in:
parent
c118c05bb2
commit
d362858184
@ -620,7 +620,7 @@ expression
|
|||||||
| SUPER superSuffix
|
| SUPER superSuffix
|
||||||
| explicitGenericInvocation
|
| explicitGenericInvocation
|
||||||
) # dottedexpression
|
) # dottedexpression
|
||||||
| expression '[' expression ']' #arrayexpression
|
| expression '[' expression ']' #arrayaccessexpression
|
||||||
| methodCall #methodcallexpression
|
| methodCall #methodcallexpression
|
||||||
| NEW creator #newinstanceexpression
|
| NEW creator #newinstanceexpression
|
||||||
| '(' annotation* typeType ('&' typeType)* ')' expression #castexpression
|
| '(' annotation* typeType ('&' typeType)* ')' expression #castexpression
|
||||||
@ -628,10 +628,10 @@ expression
|
|||||||
| prefix=('+'|'-'|'++'|'--'|'~'|'!') expression #prefixexpression
|
| prefix=('+'|'-'|'++'|'--'|'~'|'!') expression #prefixexpression
|
||||||
| expression bop=('*'|'/'|'%') expression #mathmuldivmodexpression
|
| expression bop=('*'|'/'|'%') expression #mathmuldivmodexpression
|
||||||
| expression bop=('+'|'-') expression #mathaddsubexpression
|
| expression bop=('+'|'-') expression #mathaddsubexpression
|
||||||
| expression ('<' '<' | '>' '>' '>' | '>' '>') expression #shifexpression
|
| expression ('<' '<' | '>' '>' '>' | '>' '>') expression #shiftexpression
|
||||||
| expression bop=('<=' | '>=' | '>' | '<') expression #compareexpression
|
| expression bop=('<=' | '>=' | '>' | '<') expression #relationalexpression
|
||||||
| expression bop=INSTANCEOF (typeType | pattern) #instanceofexpression
|
| expression bop=INSTANCEOF (typeType | pattern) #instanceofexpression
|
||||||
| expression bop=('==' | '!=') expression #compareequalityexpression
|
| expression bop=('==' | '!=') expression #equalityexpression
|
||||||
| expression bop='&' expression #bitwiseandexpression
|
| expression bop='&' expression #bitwiseandexpression
|
||||||
| expression bop='^' expression #bitwisexorexpression
|
| expression bop='^' expression #bitwisexorexpression
|
||||||
| expression bop='|' expression #bitwiseorexpression
|
| expression bop='|' expression #bitwiseorexpression
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -177,7 +177,7 @@ public class TypeGenerator {
|
|||||||
|
|
||||||
public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(String name, Token offset, JavaClassRegistry reg,
|
public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(String name, Token offset, JavaClassRegistry reg,
|
||||||
GenericsRegistry generics) {
|
GenericsRegistry generics) {
|
||||||
return convertTypeName(name, null, offset, reg, generics);
|
return convertTypeName(name, (Java17Parser.TypeArgumentsContext) null, offset, reg, generics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(
|
public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(
|
||||||
@ -207,6 +207,34 @@ public class TypeGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(
|
||||||
|
String name, Java17Parser.NonWildcardTypeArgumentsContext typeArguments, Token offset,
|
||||||
|
JavaClassRegistry reg,
|
||||||
|
GenericsRegistry generics) {
|
||||||
|
if (!reg.contains(name)) { // Dann könnte es ein generischer Type oder ein FunN$$-Type sein
|
||||||
|
if (generics.contains(name)) {
|
||||||
|
return new GenericRefType(name, offset);
|
||||||
|
} else {
|
||||||
|
Pattern p = Pattern.compile("Fun(\\d+)[$][$]");
|
||||||
|
Matcher m = p.matcher(name);
|
||||||
|
if (m.matches()) {// es ist FunN$$-Type
|
||||||
|
return new RefType(new JavaClassName(name), convert(typeArguments, reg, generics), offset);
|
||||||
|
} else {
|
||||||
|
throw new TypeinferenceException("Der Typ " + name + " ist nicht vorhanden", offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeArguments == null) {
|
||||||
|
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
|
||||||
|
for (int i = 0; i < reg.getNumberOfGenerics(name); i++) {
|
||||||
|
params.add(TypePlaceholder.fresh(offset));
|
||||||
|
}
|
||||||
|
return new RefType(reg.getName(name), params, offset);
|
||||||
|
} else {
|
||||||
|
return new RefType(reg.getName(name), convert(typeArguments, reg, generics), offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static List<RefTypeOrTPHOrWildcardOrGeneric> convert(Java17Parser.TypeArgumentsContext typeArguments,
|
public static List<RefTypeOrTPHOrWildcardOrGeneric> convert(Java17Parser.TypeArgumentsContext typeArguments,
|
||||||
JavaClassRegistry reg, GenericsRegistry generics) {
|
JavaClassRegistry reg, GenericsRegistry generics) {
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> ret = new ArrayList<>();
|
List<RefTypeOrTPHOrWildcardOrGeneric> ret = new ArrayList<>();
|
||||||
@ -220,4 +248,14 @@ public class TypeGenerator {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<RefTypeOrTPHOrWildcardOrGeneric> convert(
|
||||||
|
Java17Parser.NonWildcardTypeArgumentsContext typeArguments,
|
||||||
|
JavaClassRegistry reg, GenericsRegistry generics) {
|
||||||
|
List<RefTypeOrTPHOrWildcardOrGeneric> ret = new ArrayList<>();
|
||||||
|
for (Java17Parser.TypeTypeContext arg : typeArguments.typeList().typeType()) {
|
||||||
|
ret.add(convert(arg, reg, generics));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user