Package org.aspectj.org.eclipse.jdt.internal.compiler.flow

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext


    condInfo.markAsDefinitelyAssigned(this.elementVariable.binding);

    this.postCollectionInitStateIndex = currentScope.methodScope().recordInitializationStates(condInfo);
   
    // process the action
    LoopingFlowContext loopingContext =
      new LoopingFlowContext(flowContext, flowInfo, this, breakLabel,
        continueLabel, scope);
    UnconditionalFlowInfo actionInfo =
      condInfo.nullInfoLessUnconditionalCopy();
    actionInfo.markAsDefinitelyUnknown(this.elementVariable.binding);
    FlowInfo exitBranch;
    if (!(action == null || (action.isEmptyBlock()
              && currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {

      if (!this.action.complainIfUnreachable(actionInfo, scope, false)) {
        actionInfo = action.
          analyseCode(scope, loopingContext, actionInfo).
          unconditionalCopy();
      }

      // code generation can be optimized when no need to continue in the loop
      exitBranch = flowInfo.unconditionalCopy().
        addInitializationsFrom(condInfo.initsWhenFalse());
      // TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
      if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits &
          FlowInfo.UNREACHABLE) != 0) {
        continueLabel = null;
      } else {
        actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
        loopingContext.complainOnDeferredFinalChecks(scope, actionInfo);
        exitBranch.addPotentialInitializationsFrom(actionInfo);
      }
    } else {
      exitBranch = condInfo.initsWhenFalse();
    }

    // we need the variable to iterate the collection even if the
    // element variable is not used
    final boolean hasEmptyAction = this.action == null
        || this.action.isEmptyBlock()
        || ((this.action.bits & IsUsefulEmptyStatement) != 0);

    switch(this.kind) {
      case ARRAY :
        if (!hasEmptyAction
            || this.elementVariable.binding.resolvedPosition != -1) {       
          this.collectionVariable.useFlag = LocalVariableBinding.USED;
          if (this.continueLabel != null) {
            this.indexVariable.useFlag = LocalVariableBinding.USED;
            this.maxVariable.useFlag = LocalVariableBinding.USED;
          }
        }
        break;
      case RAW_ITERABLE :
      case GENERIC_ITERABLE :
        this.indexVariable.useFlag = LocalVariableBinding.USED;
        break;
    }
    //end of loop
    loopingContext.complainOnDeferredNullChecks(currentScope, actionInfo);

    FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches(
        (loopingContext.initsOnBreak.tagBits &
          FlowInfo.UNREACHABLE) != 0 ?
          loopingContext.initsOnBreak :
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.