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

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

Introduction

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

Prototype

abstract public FlowInfo initsWhenTrue();

Source Link

Document

Return the flow info that would result from the path associated to the value true for the condition expression that generated this flow info.

Usage

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());
                }/*www . jav a  2 s .c  o  m*/
            } 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;
}