Java Code Examples for com.sun.tools.javac.tree.TreeInfo#getEndPos()

The following examples show how to use com.sun.tools.javac.tree.TreeInfo#getEndPos() . 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: VeryPretty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void printIndentedStat(JCTree tree, BracesGenerationStyle redundantBraces, boolean spaceBeforeLeftBrace, WrapStyle wrapStat) {
       if (fromOffset >= 0 && toOffset >= 0 && (TreeInfo.getStartPos(tree) < fromOffset || TreeInfo.getEndPos(tree, diffContext.origUnit.endPositions) > toOffset))
           redundantBraces = BracesGenerationStyle.LEAVE_ALONE;
switch(redundantBraces) {
       case GENERATE:
           printBlock(tree, cs.getOtherBracePlacement(), spaceBeforeLeftBrace);
           return;
       case ELIMINATE:
    while(tree instanceof JCBlock) {
	List<JCStatement> t = ((JCBlock) tree).stats;
	if(t.isEmpty() || t.tail.nonEmpty()) break;
	if (t.head instanceof JCVariableDecl)
	    // bogus code has a variable declaration -- leave alone.
	    break;
	printPrecedingComments(tree, true);
	tree = t.head;
    }
       case LEAVE_ALONE:
           if (tree instanceof JCBlock) {
               printBlock(tree, cs.getOtherBracePlacement(), spaceBeforeLeftBrace);
               return;
           }
           final int old = indent();
           final JCTree toPrint = tree;
           wrapTree(wrapStat, spaceBeforeLeftBrace, out.leftMargin, new Runnable() {
               @Override public void run() {
                   printStat(toPrint);
                   undent(old);
               }
           });
}
   }
 
Example 2
Source File: TreePosTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 3
Source File: CheckAttributedTree.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 4
Source File: TreePosTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 5
Source File: CheckAttributedTree.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 6
Source File: TreePosTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 7
Source File: CheckAttributedTree.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 8
Source File: TreePosTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 9
Source File: TreePosTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 10
Source File: VeryPretty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
   public void visitTypeCast(JCTypeCast tree) {
print(cs.spaceWithinTypeCastParens() ? "( " : "(");
print(tree.clazz);
print(cs.spaceWithinTypeCastParens() ? " )" : ")");
       if (cs.spaceAfterTypeCast())
           needSpace();
       if (diffContext.origUnit != null && TreePath.getPath(diffContext.origUnit, tree.expr) != null) {
           int a = TreeInfo.getStartPos(tree.expr);
           int b = TreeInfo.getEndPos(tree.expr, diffContext.origUnit.endPositions);
           print(diffContext.origText.substring(a, b));
           return;
       }
printExpr(tree.expr, TreeInfo.prefixPrec);
   }
 
Example 11
Source File: CheckAttributedTree.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 12
Source File: CheckAttributedTree.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 13
Source File: TreePosTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 14
Source File: TreePosTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 15
Source File: CheckAttributedTree.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 16
Source File: TreePosTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 17
Source File: CheckAttributedTree.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Info(JCTree tree, EndPosTable endPosTable) {
    this.tree = tree;
    tag = tree.getTag();
    start = TreeInfo.getStartPos(tree);
    pos = tree.pos;
    end = TreeInfo.getEndPos(tree, endPosTable);
}
 
Example 18
Source File: VeryPretty.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public int endPos(JCTree t) {
    return TreeInfo.getEndPos(t, diffContext.origUnit.endPositions);
}
 
Example 19
Source File: NBParserFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public int getEndPos(JCTree jctree) {
    return TreeInfo.getEndPos(jctree, endPosTable);
}
 
Example 20
Source File: EndPosParser.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public int getEndPos(JCTree tree) {
    return TreeInfo.getEndPos(tree, endPositions);
}