Search in sources :

Example 1 with CodeTypeParameterElement

use of com.oracle.truffle.dsl.processor.java.model.CodeTypeParameterElement in project graal by oracle.

the class FlatNodeGenFactory method createInsertAccessor.

private CodeExecutableElement createInsertAccessor(boolean array) {
    CodeTypeParameterElement tVar = new CodeTypeParameterElement("T", context.getType(Node.class));
    TypeMirror type = tVar.createMirror(null, null);
    if (array) {
        type = new ArrayCodeTypeMirror(type);
    }
    CodeExecutableElement insertAccessor = new CodeExecutableElement(modifiers(FINAL), type, INSERT_ACCESSOR_NAME);
    insertAccessor.getParameters().add(new CodeVariableElement(type, "node"));
    insertAccessor.getTypeParameters().add(tVar);
    insertAccessor.createBuilder().startReturn().string("super.insert(node)").end();
    return insertAccessor;
}
Also used : CodeExecutableElement(com.oracle.truffle.dsl.processor.java.model.CodeExecutableElement) DeclaredCodeTypeMirror(com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.DeclaredCodeTypeMirror) ArrayCodeTypeMirror(com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.ArrayCodeTypeMirror) GeneratedTypeMirror(com.oracle.truffle.dsl.processor.java.model.GeneratedTypeMirror) TypeMirror(javax.lang.model.type.TypeMirror) Node(com.oracle.truffle.api.nodes.Node) CodeTypeParameterElement(com.oracle.truffle.dsl.processor.java.model.CodeTypeParameterElement) CodeVariableElement(com.oracle.truffle.dsl.processor.java.model.CodeVariableElement) ArrayCodeTypeMirror(com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.ArrayCodeTypeMirror)

Aggregations

Node (com.oracle.truffle.api.nodes.Node)1 CodeExecutableElement (com.oracle.truffle.dsl.processor.java.model.CodeExecutableElement)1 ArrayCodeTypeMirror (com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.ArrayCodeTypeMirror)1 DeclaredCodeTypeMirror (com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.DeclaredCodeTypeMirror)1 CodeTypeParameterElement (com.oracle.truffle.dsl.processor.java.model.CodeTypeParameterElement)1 CodeVariableElement (com.oracle.truffle.dsl.processor.java.model.CodeVariableElement)1 GeneratedTypeMirror (com.oracle.truffle.dsl.processor.java.model.GeneratedTypeMirror)1 TypeMirror (javax.lang.model.type.TypeMirror)1