当前位置: 首页>>代码示例>>Java>>正文


Java TreeInfo.getEndPos方法代码示例

本文整理汇总了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);
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:VeryPretty.java

示例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);
               }
           });
}
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:VeryPretty.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CasualDiff.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TreePosTest.java

示例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);
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:8,代码来源:TreePosTest.java

示例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);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:10,代码来源:DefaultInjectionResolver.java

示例7: endPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public int endPos(JCTree t) {
    return TreeInfo.getEndPos(t, diffContext.origUnit.endPositions);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:VeryPretty.java

示例8: getEndPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@Override
public int getEndPos(JCTree jctree) {
    return TreeInfo.getEndPos(jctree, endPosTable);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:NBParserFactory.java

示例9: getEndPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public int getEndPos(JCTree tree) {
    return TreeInfo.getEndPos(tree, endPositions);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:6,代码来源:EndPosParser.java


注:本文中的com.sun.tools.javac.tree.TreeInfo.getEndPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。