use of com.oracle.truffle.api.dsl.ReportPolymorphism in project graal by oracle.
the class NodeParser method parseNode.
private NodeData parseNode(TypeElement originalTemplateType) {
// reloading the type elements is needed for ecj
TypeElement templateType = ElementUtils.fromTypeMirror(context.reloadTypeElement(originalTemplateType));
if (ElementUtils.findAnnotationMirror(processingEnv, originalTemplateType, GeneratedBy.class) != null) {
// generated nodes should not get called again.
return null;
}
if (!ElementUtils.isAssignable(templateType.asType(), context.getTruffleTypes().getNode())) {
return null;
}
List<TypeElement> lookupTypes = collectSuperClasses(new ArrayList<TypeElement>(), templateType);
List<Element> members = loadMembers(templateType);
// ensure the processed element has at least one @Specialization annotation.
if (!containsSpecializations(members)) {
return null;
}
NodeData node = parseNodeData(templateType, lookupTypes);
if (node.hasErrors()) {
return node;
}
AnnotationMirror reflectable = findFirstAnnotation(lookupTypes, Introspectable.class);
if (reflectable != null) {
node.setReflectable(true);
}
AnnotationMirror reportPolymorphism = findFirstAnnotation(lookupTypes, ReportPolymorphism.class);
AnnotationMirror excludePolymorphism = findFirstAnnotation(lookupTypes, ReportPolymorphism.Exclude.class);
if (reportPolymorphism != null && excludePolymorphism == null) {
node.setReportPolymorphism(true);
}
node.getFields().addAll(parseFields(lookupTypes, members));
node.getChildren().addAll(parseChildren(node, lookupTypes, members));
node.getChildExecutions().addAll(parseExecutions(node.getFields(), node.getChildren(), members));
node.getExecutableTypes().addAll(parseExecutableTypeData(node, members, node.getSignatureSize(), context.getFrameTypes(), false));
initializeExecutableTypes(node);
initializeImportGuards(node, lookupTypes, members);
initializeChildren(node);
if (node.hasErrors()) {
// error sync point
return node;
}
node.getSpecializations().addAll(new SpecializationMethodParser(context, node).parse(members));
node.getSpecializations().addAll(new FallbackParser(context, node).parse(members));
node.getCasts().addAll(new CreateCastParser(context, node).parse(members));
if (node.hasErrors()) {
// error sync point
return node;
}
initializeSpecializations(members, node);
initializeExecutableTypeHierarchy(node);
verifySpecializationSameLength(node);
verifyVisibilities(node);
verifyMissingAbstractMethods(node, members);
verifyConstructors(node);
verifySpecializationThrows(node);
return node;
}
Aggregations