Search in sources :

Example 1 with Receiver

use of org.eclipse.jdt.internal.compiler.ast.Receiver in project spoon by INRIA.

the class JDTTreeBuilder method visit.

@Override
public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
    CtMethod<Object> m = factory.Core().createMethod();
    m.setSimpleName(CharOperation.charToString(methodDeclaration.selector));
    if (methodDeclaration.binding != null) {
        m.setExtendedModifiers(getModifiers(methodDeclaration.binding.modifiers, true, true));
    }
    for (CtExtendedModifier extendedModifier : getModifiers(methodDeclaration.modifiers, false, true)) {
        // avoid to keep implicit AND explicit modifier of the same kind.
        m.addModifier(extendedModifier.getKind());
    }
    m.setDefaultMethod(methodDeclaration.isDefaultMethod());
    context.enter(m, methodDeclaration);
    // Create block
    if (!methodDeclaration.isAbstract() && (methodDeclaration.modifiers & ClassFileConstants.AccNative) == 0) {
        context.enter(getFactory().Core().createBlock(), methodDeclaration);
        context.exit(methodDeclaration);
    }
    // We consider the receiver as a standard argument (i.e. as a parameter)
    Receiver receiver = methodDeclaration.receiver;
    if (receiver != null) {
        receiver.traverse(this, methodDeclaration.scope);
    }
    return true;
}
Also used : Receiver(org.eclipse.jdt.internal.compiler.ast.Receiver) CtExtendedModifier(spoon.support.reflect.CtExtendedModifier)

Aggregations

Receiver (org.eclipse.jdt.internal.compiler.ast.Receiver)1 CtExtendedModifier (spoon.support.reflect.CtExtendedModifier)1