本文整理汇总了Java中com.sun.tools.javac.tree.TreeInfo.notExpression方法的典型用法代码示例。如果您正苦于以下问题:Java TreeInfo.notExpression方法的具体用法?Java TreeInfo.notExpression怎么用?Java TreeInfo.notExpression使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.tree.TreeInfo
的用法示例。
在下文中一共展示了TreeInfo.notExpression方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VeryPretty
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
private VeryPretty(Context context, CodeStyle cs, Map<Tree, ?> tree2Tag, Map<Tree, DocCommentTree> tree2Doc, Map<?, int[]> tag2Span, String origText) {
names = Names.instance(context);
enclClass = null;
commentHandler = CommentHandlerService.instance(context);
operators = Operators.instance(context);
widthEstimator = new WidthEstimator(context);
danglingElseChecker = new DanglingElseChecker();
prec = TreeInfo.notExpression;
this.cs = cs;
out = new CharBuffer(cs.getRightMargin(), cs.getTabSize(), cs.expandTabToSpaces());
out.addTrimObserver(this);
this.indentSize = cs.getIndentSize();
this.tree2Tag = tree2Tag;
this.tree2Doc = tree2Doc == null ? Collections.EMPTY_MAP : tree2Doc;
this.tag2Span = (Map<Object, int[]>) tag2Span;//XXX
this.origText = origText;
this.comments = CommentHandlerService.instance(context);
}
示例2: visitVarDef
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public void visitVarDef(JCVariableDecl tree) {
try {
boolean suppressSemi = suppressFinalAndSemicolonsInTry;
if (getJavadocFor(tree) != null) {
println(); align();
}
printDocComment(tree);
if ((tree.mods.flags & ENUM) != 0) {
printEnumMember(tree);
} else {
printExpr(tree.mods);
if ((tree.mods.flags & VARARGS) != 0) {
printExpr(((JCArrayTypeTree) tree.vartype).elemtype);
print("... " + tree.name);
} else {
printExpr(tree.vartype);
print(" " + tree.name);
}
if (tree.init != null) {
print(" = ");
printExpr(tree.init);
}
if (prec == TreeInfo.notExpression && !suppressSemi) print(";");
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例3: visitExec
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public void visitExec(JCExpressionStatement tree) {
if (isNoArgsSuperCall(tree.expr)) return;
try {
printExpr(tree.expr);
if (prec == TreeInfo.notExpression) print(";");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例4: visitVarDef
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public void visitVarDef(JCVariableDecl tree) {
try {
if (docComments != null && docComments.get(tree) != null) {
println(); align();
}
printDocComment(tree);
if ((tree.mods.flags & ENUM) != 0) {
printEnumMember(tree);
} else {
printExpr(tree.mods);
if ((tree.mods.flags & VARARGS) != 0) {
printExpr(((JCArrayTypeTree) tree.vartype).elemtype);
print("... " + tree.name);
} else {
printExpr(tree.vartype);
print(" " + tree.name);
}
if (tree.init != null) {
print(" = ");
printExpr(tree.init);
}
if (prec == TreeInfo.notExpression) print(";");
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例5: visitExec
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
public void visitExec(JCExpressionStatement tree) {
if (isNoArgsSuperCall(tree.expr)) return;
try {
printExpr(tree.expr);
if (prec == TreeInfo.notExpression) print(";");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例6: visitVarDef
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@Override
public void visitVarDef(JCVariableDecl tree) {
boolean notEnumConst = (tree.mods.flags & Flags.ENUM) == 0;
printAnnotations(tree.mods.annotations);
if (notEnumConst) {
printFlags(tree.mods.flags);
if (!suppressVariableType) {
if ((tree.mods.flags & VARARGS) != 0) {
// Variable arity method. Expecting ArrayType, print ... instead of [].
if (Kind.ARRAY_TYPE == tree.vartype.getKind()) {
printExpr(((JCArrayTypeTree) tree.vartype).elemtype);
} else {
printExpr(tree.vartype);
}
print("...");
} else {
print(tree.vartype);
}
}
}
if (tree.vartype != null && !suppressVariableType) //should also check the flags?
needSpace();
if (!ERROR.contentEquals(tree.name))
print(tree.name);
if (tree.init != null) {
if (notEnumConst) {
printVarInit(tree);
} else {
JCNewClass newClsTree = (JCNewClass) tree.init;
if (newClsTree.args.nonEmpty()) {
print(cs.spaceBeforeMethodCallParen() ? " (" : "(");
if (cs.spaceWithinMethodCallParens())
print(' ');
wrapTrees(newClsTree.args,
cs.wrapMethodCallArgs(),
cs.alignMultilineCallArgs() ? out.col : out.leftMargin + cs.getContinuationIndentSize()
);
print(cs.spaceWithinMethodCallParens() ? " )" : ")");
}
if (newClsTree.def != null) {
JCClassDecl enclClassPrev = enclClass;
enclClass = newClsTree.def;
printBlock(null, newClsTree.def.defs, cs.getOtherBracePlacement(), cs.spaceBeforeClassDeclLeftBrace(), true);
enclClass = enclClassPrev;
}
}
}
if ((prec == TreeInfo.notExpression) && notEnumConst) {
print(';');
}
}
示例7: visitExec
import com.sun.tools.javac.tree.TreeInfo; //导入方法依赖的package包/类
@Override
public void visitExec(JCExpressionStatement tree) {
printNoParenExpr(tree.expr);
if (prec == TreeInfo.notExpression)
print(';');
}