本文整理汇总了Java中com.sun.tools.javac.tree.TreeInfo.getEndPos方法的典型用法代码示例。如果您正苦于以下问题:Java TreeInfo.getEndPos方法的具体用法?Java TreeInfo.getEndPos怎么用?Java TreeInfo.getEndPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.tree.TreeInfo
的用法示例。
在下文中一共展示了TreeInfo.getEndPos方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitTypeCast
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@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);
}
示例2: printIndentedStat
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
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);
}
});
}
}
示例3: endPos
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public int endPos(JCTree t) {
// compensate for FieldGroupTree, see issue #237574
if (t instanceof FieldGroupTree) {
FieldGroupTree fgt = (FieldGroupTree)t;
VariableTree vt = fgt.getVariables().get(fgt.getVariables().size() - 1);
return TreeInfo.getEndPos((JCTree)vt, oldTopLevel.endPositions);
}
return TreeInfo.getEndPos(t, oldTopLevel.endPositions);
}
示例4: Info
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
Info(JCTree tree, EndPosTable endPosTable) {
this.tree = tree;
tag = tree.getTag();
start = TreeInfo.getStartPos(tree);
pos = tree.pos;
end = TreeInfo.getEndPos(tree, endPosTable);
}
示例5: Info
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
Info(JCTree tree, Map<JCTree, Integer> endPosTable) {
this.tree = tree;
tag = tree.getTag();
start = TreeInfo.getStartPos(tree);
pos = tree.pos;
end = TreeInfo.getEndPos(tree, endPosTable);
}
示例6: replace
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@Override
public void replace(Tree source, String newSource) {
changed();
finish();
final EndPosTable endPosTable = ((JCCompilationUnit) cup).endPositions;
final int endPos = TreeInfo.getEndPos((JCTree) source, endPosTable);
final int startPos = TreeInfo.getStartPos((JCTree) source);
sources.requestOverwrite(cup, startPos, endPos, newSource);
}
示例7: endPos
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public int endPos(JCTree t) {
return TreeInfo.getEndPos(t, diffContext.origUnit.endPositions);
}
示例8: getEndPos
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@Override
public int getEndPos(JCTree jctree) {
return TreeInfo.getEndPos(jctree, endPosTable);
}
示例9: getEndPos
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public int getEndPos(JCTree tree) {
return TreeInfo.getEndPos(tree, endPositions);
}