com.sun.tools.javac.tree.JCTree.JCDoWhileLoop Java Examples

The following examples show how to use com.sun.tools.javac.tree.JCTree.JCDoWhileLoop. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrettyCommentsPrinter.java    From EasyMPermission with MIT License 6 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
	try {
		print("do ");
		printStat(tree.body);
		align();
		print(" while ");
		if (PARENS.equals(treeTag(tree.cond))) {
			printExpr(tree.cond);
		} else {
			print("(");
			printExpr(tree.cond);
			print(")");
		}
		print(";");
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
Example #2
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    ListBuffer<PendingExit> prevPendingExits = pendingExits;
    pendingExits = new ListBuffer<>();
    scanStat(tree.body);
    alive |= resolveContinues(tree);
    scan(tree.cond);
    alive = alive && !tree.cond.type.isTrue();
    alive |= resolveBreaks(tree, prevPendingExits);
}
 
Example #3
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    ListBuffer<FlowPendingExit> prevPendingExits = pendingExits;
    pendingExits = new ListBuffer<>();
    scan(tree.body);
    resolveContinues(tree);
    scan(tree.cond);
    resolveBreaks(tree, prevPendingExits);
}
 
Example #4
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    ListBuffer<AssignPendingExit> prevPendingExits = pendingExits;
    FlowKind prevFlowKind = flowKind;
    flowKind = FlowKind.NORMAL;
    final Bits initsSkip = new Bits(true);
    final Bits uninitsSkip = new Bits(true);
    pendingExits = new ListBuffer<>();
    int prevErrors = log.nerrors;
    do {
        final Bits uninitsEntry = new Bits(uninits);
        uninitsEntry.excludeFrom(nextadr);
        scan(tree.body);
        resolveContinues(tree);
        scanCond(tree.cond);
        if (!flowKind.isFinal()) {
            initsSkip.assign(initsWhenFalse);
            uninitsSkip.assign(uninitsWhenFalse);
        }
        if (log.nerrors !=  prevErrors ||
            flowKind.isFinal() ||
            new Bits(uninitsEntry).diffSet(uninitsWhenTrue).nextBit(firstadr)==-1)
            break;
        inits.assign(initsWhenTrue);
        uninits.assign(uninitsEntry.andSet(uninitsWhenTrue));
        flowKind = FlowKind.SPECULATIVE_LOOP;
    } while (true);
    flowKind = prevFlowKind;
    inits.assign(initsSkip);
    uninits.assign(uninitsSkip);
    resolveBreaks(tree, prevPendingExits);
}
 
Example #5
Source File: CompilationUnitBuilder.java    From j2cl with Apache License 2.0 5 votes vote down vote up
private DoWhileStatement convertDoWhileLoop(JCDoWhileLoop statement) {
  return DoWhileStatement.newBuilder()
      .setSourcePosition(getSourcePosition(statement))
      .setConditionExpression(convertConditionRemovingOuterParentheses(statement.getCondition()))
      .setBody(convertStatement(statement.getStatement()))
      .build();
}
 
Example #6
Source File: CRTable.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
    sr.mergeWith(csp(tree.body));
    sr.mergeWith(csp(tree.cond));
    result = sr;
}
 
Example #7
Source File: TransTypes.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    tree.body = translate(tree.body);
    tree.cond = translate(tree.cond, syms.booleanType);
    result = tree;
}
 
Example #8
Source File: Lower.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitDoLoop(JCDoWhileLoop tree) {
    tree.body = translate(tree.body);
    tree.cond = translate(tree.cond, syms.booleanType);
    result = tree;
}
 
Example #9
Source File: Analyzer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void visitDoLoop(JCDoWhileLoop tree) {
    //skip body (to prevents same statements to be analyzed twice)
    scan(tree.getCondition());
}
 
Example #10
Source File: CompilationUnitBuilder.java    From j2cl with Apache License 2.0 4 votes vote down vote up
private Statement convertStatement(JCStatement jcStatement) {
  switch (jcStatement.getKind()) {
    case ASSERT:
      return convertAssert((JCAssert) jcStatement);
    case BLOCK:
      return convertBlock((JCBlock) jcStatement);
    case BREAK:
      return convertBreak((JCBreak) jcStatement);
    case CLASS:
      convertClassDeclaration((JCClassDecl) jcStatement);
      return null;
    case CONTINUE:
      return convertContinue((JCContinue) jcStatement);
    case DO_WHILE_LOOP:
      return convertDoWhileLoop((JCDoWhileLoop) jcStatement);
    case EMPTY_STATEMENT:
      return new EmptyStatement(getSourcePosition(jcStatement));
    case ENHANCED_FOR_LOOP:
      return convertEnhancedForLoop((JCEnhancedForLoop) jcStatement);
    case EXPRESSION_STATEMENT:
      return convertExpressionStatement((JCExpressionStatement) jcStatement);
    case FOR_LOOP:
      return convertForLoop((JCForLoop) jcStatement);
    case IF:
      return convertIf((JCIf) jcStatement);
    case LABELED_STATEMENT:
      return convertLabeledStatement((JCLabeledStatement) jcStatement);
    case RETURN:
      return convertReturn((JCReturn) jcStatement);
    case SWITCH:
      return convertSwitch((JCSwitch) jcStatement);
    case THROW:
      return convertThrow((JCThrow) jcStatement);
    case TRY:
      return convertTry((JCTry) jcStatement);
    case VARIABLE:
      return convertVariableDeclaration((JCVariableDecl) jcStatement);
    case WHILE_LOOP:
      return convertWhileLoop((JCWhileLoop) jcStatement);
    case SYNCHRONIZED:
      return convertSynchronized((JCSynchronized) jcStatement);
    default:
      throw new AssertionError("Unknown statement node type: " + jcStatement.getKind());
  }
}
 
Example #11
Source File: Analyzer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitDoLoop(JCDoWhileLoop tree) {
    scan(tree.getCondition());
}
 
Example #12
Source File: JavacTreeMaker.java    From EasyMPermission with MIT License 4 votes vote down vote up
public JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond) {
	return invoke(DoLoop, body, cond);
}
 
Example #13
Source File: UDoWhileLoop.java    From Refaster with Apache License 2.0 4 votes vote down vote up
@Override
public JCDoWhileLoop inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().DoLoop(getStatement().inline(inliner), getCondition().inline(inliner));
}