Example usage for org.eclipse.jdt.internal.compiler.ast FieldReference resolveType

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

Introduction

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

Prototype

@Override
    public TypeBinding resolveType(BlockScope scope) 

Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.MethodSpec.java

License:Open Source License

/**
 * Same as above, but consider specified signature for argument mapping (using AnchorMapping).
 * @param receiverType receiver of the method call.
 * @param scope//ww  w .  ja v a 2s .com
 * @param isBaseSide
 * @param callinExpected whether this method spec is the LHS of a replace callin.
 * @param allowEnclosing whether a method may be found in an enclosing type of receiverType
 */
public void resolveFeatureWithArgMapping(ReferenceBinding receiverType, BlockScope scope, boolean isBaseSide,
        boolean callinExpected, boolean allowEnclosing) {
    FieldReference receiver = null;
    if (isBaseSide) {
        // construct temporary faked receiver
        ReferenceContext referenceContext = scope.referenceContext();
        CheckPoint cp = referenceContext.compilationResult().getCheckPoint(referenceContext);
        receiver = new FieldReference(IOTConstants._OT_BASE, 0L); // can't fail, help the compiler recognize that receiver won't be null below.
        try {
            receiver.receiver = ThisReference.implicitThis();
            receiver.resolveType(scope);
        } finally {
            if (receiver.binding == null || !receiver.binding.isValidBinding()) {
                // resolve didn't work, which happens if role is ifc, thus has no base field
                // at least set the receiver type.
                // TODO(SH): this means, role ifcs can not use base-anchored types.
                receiver.resolvedType = receiverType;
                referenceContext.compilationResult().rollBack(cp);
            }
        }
    }
    AnchorMapping anchorMapping = null;
    try {
        anchorMapping = AnchorMapping.setupNewMapping(receiver, this.arguments, scope);
        resolveFeature(receiverType, scope, callinExpected, isBaseSide, allowEnclosing);
    } finally {
        AnchorMapping.removeCurrentMapping(anchorMapping);
    }
}