Example usage for org.eclipse.jdt.core.dom SuperFieldAccess getQualifier

List of usage examples for org.eclipse.jdt.core.dom SuperFieldAccess getQualifier

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperFieldAccess getQualifier.

Prototype

public Name getQualifier() 

Source Link

Document

Returns the qualifier of this "super" field access expression, or null if there is none.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(SuperFieldAccess node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.fBuffer.append(".");//$NON-NLS-1$
    }//  w  w w . j av a  2 s.  c  om
    this.fBuffer.append("super.");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(SuperFieldAccess node) {
    boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder();
    //      b.setPosition(pos.build());
    b.setKind(boa.types.Ast.Expression.ExpressionKind.VARACCESS);
    String name = "super." + node.getName().getFullyQualifiedName();
    if (node.getQualifier() != null)
        name = node.getQualifier().getFullyQualifiedName() + "." + name;
    b.setVariable(name);/* w  w w.  j  ava 2s.  c  om*/
    expressions.push(b.build());
    return false;
}

From source file:ca.mcgill.cs.swevo.ppa.PPAASTUtil.java

License:Open Source License

/**
 * <p>//ww  w  .j a v  a2s .c o  m
 * Convenience method to exclude self and/or name.
 * </p>
 * 
 * @param node
 * @param includeSelf
 * @return
 */
public static ASTNode getFieldContainer(ASTNode node, boolean includeSpecial, boolean includeSelf) {
    ASTNode container = null;

    // XXX Special case: if you want the container of the first qualifier in
    // a qualified name,
    // You want the type declaration (or whatever is the top-level parent),
    // but not the
    // qualified name.
    if (!includeSelf && includeSpecial) {
        ASTNode parent = node.getParent();
        if (parent instanceof QualifiedName) {
            QualifiedName qName = (QualifiedName) parent;
            if (qName.getQualifier().equals(node)) {
                return getFieldContainer(parent, includeSpecial, includeSelf);
            }
        }
    }

    if (node == null) {
        container = null;
    } else if (includeSelf && isFieldContainer(node, includeSpecial)) {
        if (node instanceof QualifiedName) {
            container = ((QualifiedName) node).getQualifier();
        } else if (node instanceof SuperFieldAccess) {
            SuperFieldAccess sFieldAccess = (SuperFieldAccess) node;
            if (sFieldAccess.getQualifier() != null) {
                container = sFieldAccess.getQualifier();
            } else {
                container = getFieldContainer(node.getParent(), includeSpecial, true);
            }
        } else if (node instanceof FieldAccess) {
            container = ((FieldAccess) node).getExpression();
        } else {
            container = node;
        }
    } else {
        container = getFieldContainer(node.getParent(), includeSpecial, true);
    }

    return container;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(SuperFieldAccess node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }//  w  w  w . ja v  a2  s.c o m
    this.buffer.append("super.");//$NON-NLS-1$
    node.getName().accept(this);
    return false;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(SuperFieldAccess node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        sb.print(".");
    }/*  w w w  . j  a  v a2 s  .c  om*/
    sb.print("super.");
    node.getName().accept(this);
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link SuperFieldAccess}es. */
@Override/*from ww  w  .jav a  2  s .co  m*/
public boolean visit(SuperFieldAccess node) {
    sync(node);
    builder.open(plusFour);
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        builder.breakOp();
        token(".");
    }
    token("super");
    builder.breakOp();
    token(".");
    visit(node.getName());
    builder.close();
    return false;
}

From source file:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java

License:Open Source License

private CAstNode visit(SuperFieldAccess n, WalkContext context) {
    CAstNode targetNode;/*from w w  w . ja  v  a 2 s  .  c o m*/
    if (n.getQualifier() == null)
        targetNode = makeNode(context, fFactory, n, CAstNode.SUPER);
    else {
        TypeReference owningTypeRef = fIdentityMapper.getTypeRef(n.getQualifier().resolveTypeBinding());
        targetNode = makeNode(context, fFactory, n, CAstNode.SUPER, fFactory.makeConstant(owningTypeRef));
    }
    return createFieldAccess(targetNode, n.getName().getIdentifier(), n.resolveFieldBinding(), n, context);
}

From source file:edu.cmu.cs.crystal.cfg.eclipse.EclipseCFG.java

License:Open Source License

@Override
public void endVisit(SuperFieldAccess node) {
    EclipseCFGNode field = nodeMap.get(node);
    EclipseCFGNode name = nodeMap.get(node.getName());

    createEdge(name.getEnd(), field);//  w  w  w  .ja  v a2s. co  m

    if (node.getQualifier() != null) {
        EclipseCFGNode qual = nodeMap.get(node.getQualifier());
        createEdge(qual.getEnd(), name.getStart());
        field.setStart(qual.getStart());
    } else
        field.setStart(name.getStart());
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.SuperFieldAccess node) {
    SuperFieldAccess element = (SuperFieldAccess) this.binding.get(node);
    this.initializeNode(element, node);

    if (this.binding.get(node.getName()) != null)
        element.setField((NamedElementRef) this.binding.get(node.getName()));
    if (this.binding.get(node.getQualifier()) != null)
        element.setQualifier((NamedElementRef) this.binding.get(node.getQualifier()));
}

From source file:lang.java.jdt.internal.JdtAstToRascalAstConverter.java

License:Open Source License

public boolean visit(SuperFieldAccess node) {
    IValue qualifier = node.getQualifier() == null ? null : visitChild(node.getQualifier());
    IValue name = values.string((node.getName().getFullyQualifiedName()));

    ownValue = constructRascalNode(node, optional(qualifier), name);
    return false;
}