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


Java TreeInfo.getStartPos方法代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.TreeInfo.getStartPos方法的典型用法代码示例。如果您正苦于以下问题:Java TreeInfo.getStartPos方法的具体用法?Java TreeInfo.getStartPos怎么用?Java TreeInfo.getStartPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.tree.TreeInfo的用法示例。


在下文中一共展示了TreeInfo.getStartPos方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOldPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
private int getOldPos(JCTree oldT) {
    if (overrideStartPositions != null) {
        Integer i = overrideStartPositions.get(oldT);
        if (i != null) {
            return i;
        }
    }
    return TreeInfo.getStartPos(oldT);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:VeryPretty.java

示例2: 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

示例3: 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

示例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: FieldGroupTree

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
private FieldGroupTree(List<JCVariableDecl> vars, boolean enumeration, boolean moreElementsFollowEnum) {
    this.vars = vars;
    pos = TreeInfo.getStartPos(vars.get(0));
    this.enumeration = enumeration;
    this.moreElementsFollowEnum = moreElementsFollowEnum;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:FieldGroupTree.java

示例8: getOldPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
private static int getOldPos(JCTree oldT) {
    return TreeInfo.getStartPos(oldT);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:CasualDiff.java

示例9: getStartPos

import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
/** Get the start position for a tree node.  The start position is
 * defined to be the position of the first character of the first
 * token of the node's source text.
 * @param tree  The tree node
 */
public int getStartPos(JCTree tree) {
    return TreeInfo.getStartPos(tree);
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:9,代码来源:JavacParser.java


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