Example usage for org.eclipse.jdt.internal.compiler.ast QualifiedThisReference QualifiedThisReference

List of usage examples for org.eclipse.jdt.internal.compiler.ast QualifiedThisReference QualifiedThisReference

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast QualifiedThisReference QualifiedThisReference.

Prototype

public QualifiedThisReference(TypeReference name, int sourceStart, int sourceEnd) 

Source Link

Usage

From source file:lombok.eclipse.handlers.ast.EclipseASTMaker.java

License:Open Source License

@Override
public ASTNode visitThis(final lombok.ast.This node, final Void p) {
    final ThisReference thisReference;
    if (node.getType() != null) {
        thisReference = new QualifiedThisReference(build(node.getType(), TypeReference.class), 0, 0);
    } else {//from   www. jav a  2 s .  c  om
        thisReference = new ThisReference(0, 0);
        if (node.isImplicit()) {
            thisReference.bits |= ASTNode.IsImplicitThis;
        }
    }
    setGeneratedByAndCopyPos(thisReference, source, posHintOf(node));
    return thisReference;
}

From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java

License:Open Source License

protected void consumePrimaryNoNewArrayNameThis() {
    // PrimaryNoNewArray ::= Name '.' 'this'
    // handle type arguments
    pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
    pushOnGenericsLengthStack(0); // handle type arguments

    TypeReference typeReference = getTypeReference(0);

    pushOnExpressionStack(// w  w  w.j a v  a2s  . c  o m
            new QualifiedThisReference(typeReference, this.intStack[this.intPtr--], this.endPosition));
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstClone.java

License:Open Source License

public static Reference copyReference(Reference nameRef) {
    if (nameRef instanceof SingleNameReference) {
        SingleNameReference singleRef = (SingleNameReference) nameRef;
        return new SingleNameReference(singleRef.token,
                ((long) singleRef.sourceStart << 32) + singleRef.sourceEnd);
    } else if (nameRef instanceof QualifiedNameReference) {
        QualifiedNameReference qualRef = (QualifiedNameReference) nameRef;
        return new QualifiedNameReference(qualRef.tokens, qualRef.sourcePositions, qualRef.sourceStart,
                qualRef.sourceEnd);/* w w w .  j av  a 2  s  .c  o m*/
    } else if (nameRef instanceof FieldReference) {
        FieldReference fieldRef = (FieldReference) nameRef;
        FieldReference clone = new FieldReference(fieldRef.token, fieldRef.nameSourcePosition);
        clone.receiver = copyReference((Reference) fieldRef.receiver);
        return clone;
    } else if (nameRef instanceof QualifiedBaseReference) {
        QualifiedBaseReference baseRef = (QualifiedBaseReference) nameRef;
        return new QualifiedBaseReference(copyTypeReference(baseRef.qualification), baseRef.sourceStart,
                baseRef.sourceEnd);
    } else if (nameRef instanceof QualifiedThisReference) {
        QualifiedThisReference thisRef = (QualifiedThisReference) nameRef;
        return new QualifiedThisReference(copyTypeReference(thisRef.qualification), thisRef.sourceStart,
                thisRef.sourceEnd);
    }
    throw new InternalCompilerError("Unexpected reference type " + nameRef.getClass() + " for " + nameRef); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java

License:Open Source License

/**
 * Create a lifting of an expression to an expectedType if expectedType is in deed
 * a role type different from the type of expression (deferred decision).
 * Assumes that the role must be within the current scope so that a qualified this
 * suffices as a receiver for the lift call.
 *
 * @param receiver     receiver for the lift call (referring to some team instance)
 * @param expression   the exression to be lifted
 * @param expectedType the required role(?) type
 * @param reversible   is reversibility of this operation requested (callin replace)?
 * @return a PotentialLiftExpression or the original expression
 *//* www.  ja v  a2 s . co  m*/
public Expression potentialLift(Expression receiver, Expression expression, TypeBinding expectedType,
        boolean reversible) {
    if (expectedType.leafComponentType().isBaseType())
        return expression; // cannot lift to simple
    ReferenceBinding expectedRef = (ReferenceBinding) expectedType.leafComponentType();
    ReferenceBinding teamBinding = expectedRef.enclosingType();
    if (teamBinding == null || !teamBinding.isTeam())
        return expression;
    if (receiver == null)
        receiver = new QualifiedThisReference(typeReference(teamBinding), this.sourceStart, this.sourceEnd);
    PotentialLiftExpression lifter = new PotentialLiftExpression(receiver, expression, expectedType);
    lifter.requireReverseOperation = reversible;
    return lifter;
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java

License:Open Source License

/**
 * @param binding prefix the "this" reference by this type.
 * @return Outer.this where "Outer" is identified by binding
 *///from  ww  w  . j a  v  a2s .  co  m
public Reference qualifiedThisReference(ReferenceBinding binding) {
    return new QualifiedThisReference(typeReference(binding), this.sourceStart, this.sourceEnd);
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java

License:Open Source License

/**
 * @param reference prefix the "this" reference by this type.
 * @return Outer.this where "Outer" is identified by reference
 *///from  w w  w .java  2  s . c o  m
public Expression qualifiedThisReference(TypeReference reference) {
    return new QualifiedThisReference(reference, this.sourceStart, this.sourceEnd);
}

From source file:org.nabucco.framework.mda.template.java.extract.statement.JavaAstStatementExtractorVisitor.java

License:Open Source License

@Override
public boolean visit(QualifiedThisReference qualifiedThisReference, BlockScope scope) {

    TypeReference qualification = copy(qualifiedThisReference.qualification);

    QualifiedThisReference thisCopy = new QualifiedThisReference(qualification,
            qualifiedThisReference.sourceStart, qualifiedThisReference.sourceEnd);

    this.statement = thisCopy;

    return false;
}

From source file:org.nabucco.framework.mda.template.java.extract.statement.JavaAstStatementExtractorVisitor.java

License:Open Source License

@Override
public boolean visit(QualifiedThisReference qualifiedThisReference, ClassScope scope) {

    TypeReference qualification = copy(qualifiedThisReference.qualification);

    QualifiedThisReference thisCopy = new QualifiedThisReference(qualification,
            qualifiedThisReference.sourceStart, qualifiedThisReference.sourceEnd);

    this.statement = thisCopy;

    return false;
}