Example usage for org.eclipse.jdt.internal.compiler.flow FlowInfo markAsDefinitelyAssigned

List of usage examples for org.eclipse.jdt.internal.compiler.flow FlowInfo markAsDefinitelyAssigned

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.flow FlowInfo markAsDefinitelyAssigned.

Prototype

abstract public void markAsDefinitelyAssigned(LocalVariableBinding local);

Source Link

Document

Record a local got definitely assigned.

Usage

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

License:Open Source License

public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
    flowInfo = super.analyseCode(currentScope, flowContext, flowInfo);
    MethodDeclaration callinMethod = getEnclosingCallinMethod(currentScope);
    LocalVariableBinding trackingVariable = callinMethod.baseCallTrackingVariable.binding;
    if (flowInfo.isDefinitelyAssigned(callinMethod.baseCallTrackingVariable))
        currentScope.problemReporter().definitelyDuplicateBasecall(this._wrappee);
    else if (flowInfo.isPotentiallyAssigned(trackingVariable))
        currentScope.problemReporter().potentiallyDuplicateBasecall(this._wrappee);
    else/*  w  w w.j a  va  2 s.  c  o  m*/
        flowInfo.markAsDefinitelyAssigned(trackingVariable);

    // check exceptions thrown by any bound base method:
    MethodScope methodScope = currentScope.methodScope();
    if (methodScope != null) {
        MethodModel methodModel = methodScope.referenceMethod().binding.model;
        if (methodModel != null && methodModel._baseExceptions != null) {
            for (ReferenceBinding exceptionType : methodModel._baseExceptions)
                flowContext.checkExceptionHandlers(exceptionType, this, flowInfo, currentScope);
        }
    }

    if (this.isSuperAccess)
        //    signal that the base call surrogate needs to handle super-access:
        MethodModel.addCallinFlag(currentScope.methodScope().referenceMethod(),
                IOTConstants.CALLIN_FLAG_BASE_SUPER_CALL);

    return flowInfo;
}

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

License:Open Source License

/** Check whether this message send contributes to base call analysis */
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
    flowInfo = super.analyseCode(currentScope, flowContext, flowInfo);
    if (this.binding.isCallin()) {
        MethodBinding tsuperMethod = this.binding;
        if (tsuperMethod.copyInheritanceSrc != null)
            tsuperMethod = tsuperMethod.copyInheritanceSrc;
        if (!MethodModel.hasCallinFlag(tsuperMethod, CALLIN_FLAG_DEFINITELY_MISSING_BASECALL)) { // no contribution if no base call.
            MethodDeclaration callinMethod = (MethodDeclaration) currentScope.methodScope().referenceContext;
            LocalVariableBinding trackingVariable = callinMethod.baseCallTrackingVariable.binding;
            if (MethodModel.hasCallinFlag(tsuperMethod, CALLIN_FLAG_POTENTIALLY_MISSING_BASECALL)) {
                if (flowInfo.isDefinitelyAssigned(trackingVariable)
                        || flowInfo.isPotentiallyAssigned(trackingVariable)) {
                    currentScope.problemReporter().potentiallyDuplicateBasecall(this);
                } else {
                    FlowInfo potential = flowInfo.copy();
                    potential.markAsDefinitelyAssigned(trackingVariable);
                    flowInfo = FlowInfo.conditional(flowInfo.initsWhenTrue(), potential.initsWhenTrue());
                }//from w w  w .  ja va2  s  .  c  om
            } else { // tsuper definitely has a base call:
                if (flowInfo.isDefinitelyAssigned(trackingVariable))
                    currentScope.problemReporter().definitelyDuplicateBasecall(this);
                else if (flowInfo.isPotentiallyAssigned(trackingVariable))
                    currentScope.problemReporter().potentiallyDuplicateBasecall(this);
                if (!flowInfo.isDefinitelyAssigned(trackingVariable))
                    flowInfo.markAsDefinitelyAssigned(trackingVariable);
            }
        }
    }
    return flowInfo;
}

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

License:Open Source License

@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
    // type value parameters are assigned by construction.
    flowInfo.markAsDefinitelyAssigned(this.fieldBinding);
    return flowInfo;
}