use of com.oracle.truffle.dsl.processor.model.ParameterSpec in project graal by oracle.
the class TypeCheckParser method createSpecification.
@Override
public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
MethodSpec spec = new MethodSpec(new ParameterSpec("returnType", getContext().getType(boolean.class)));
spec.addRequired(new ParameterSpec("value", getContext().getType(Object.class)));
return spec;
}
use of com.oracle.truffle.dsl.processor.model.ParameterSpec in project graal by oracle.
the class FallbackParser method createValueParameterSpec.
@Override
protected ParameterSpec createValueParameterSpec(NodeExecutionData execution) {
ParameterSpec spec = new ParameterSpec(execution.getName(), Arrays.asList(getNode().getGenericType(execution)));
spec.setExecution(execution);
spec.setAllowSubclasses(false);
return spec;
}
use of com.oracle.truffle.dsl.processor.model.ParameterSpec in project graal by oracle.
the class ImplicitCastParser method createSpecification.
@Override
public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
MethodSpec spec = new MethodSpec(new ParameterSpec("target", getContext().getType(Object.class)));
spec.addRequired(new ParameterSpec("source", getContext().getType(Object.class))).setSignature(true);
return spec;
}
use of com.oracle.truffle.dsl.processor.model.ParameterSpec in project graal by oracle.
the class MethodSpecParser method parseParametersRequired.
private static List<Parameter> parseParametersRequired(MethodSpec spec, List<VariableElement> types, boolean typeVarArgs) {
List<Parameter> parsedParams = new ArrayList<>();
List<ParameterSpec> specifications = spec.getRequired();
boolean specVarArgs = spec.isVariableRequiredParameters();
int typeIndex = 0;
int specificationIndex = 0;
ParameterSpec specification;
while ((specification = nextSpecification(specifications, specificationIndex, specVarArgs)) != null) {
VariableElement actualType = nextActualType(types, typeIndex, typeVarArgs);
if (actualType == null) {
if (spec.isIgnoreAdditionalSpecifications()) {
break;
}
return null;
}
int typeVarArgsIndex = typeVarArgs ? typeIndex - types.size() + 1 : -1;
int specVarArgsIndex = specVarArgs ? specificationIndex - specifications.size() + 1 : -1;
if (typeVarArgsIndex >= 0 && specVarArgsIndex >= 0) {
// we would get into an endless loop if we would continue
break;
}
Parameter resolvedParameter = matchParameter(specification, actualType, specVarArgsIndex, typeVarArgsIndex);
if (resolvedParameter == null) {
return null;
}
parsedParams.add(resolvedParameter);
typeIndex++;
specificationIndex++;
}
// consume randomly ordered annotated parameters
VariableElement variable;
while ((variable = nextActualType(types, typeIndex, typeVarArgs)) != null) {
Parameter matchedParamter = matchAnnotatedParameter(spec, variable);
if (matchedParamter == null) {
break;
}
parsedParams.add(matchedParamter);
typeIndex++;
}
if (typeIndex < types.size()) {
if (spec.isIgnoreAdditionalParameters()) {
return parsedParams;
} else {
return null;
}
}
return parsedParams;
}
use of com.oracle.truffle.dsl.processor.model.ParameterSpec in project graal by oracle.
the class NodeMethodParser method createValueParameterSpec.
protected ParameterSpec createValueParameterSpec(NodeExecutionData execution) {
ParameterSpec spec = new ParameterSpec(execution.getName(), getPossibleParameterTypes(execution));
spec.setExecution(execution);
return spec;
}
Aggregations