Java Code Examples for com.sun.tools.javac.tree.JCTree#Tag
The following examples show how to use
com.sun.tools.javac.tree.JCTree#Tag .
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: Trees.java From google-java-format with Apache License 2.0 | 5 votes |
/** Returns the string name of an operator, including assignment and compound assignment. */ static String operatorName(ExpressionTree expression) { JCTree.Tag tag = ((JCTree) expression).getTag(); if (tag == JCTree.Tag.ASSIGN) { return "="; } boolean assignOp = expression instanceof CompoundAssignmentTree; if (assignOp) { tag = tag.noAssignOp(); } String name = new Pretty(/*writer*/ null, /*sourceOutput*/ true).operatorName(tag); return assignOp ? name + "=" : name; }
Example 2
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Entry point for resolving a unary operator given an operator tag and an argument type. */ OperatorSymbol resolveUnary(DiagnosticPosition pos, JCTree.Tag tag, Type op) { return resolve(tag, unaryOperators, unop -> unop.test(op), unop -> unop.resolve(op), () -> reportErrorIfNeeded(pos, tag, op)); }
Example 3
Source File: Lower.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Make an attributed unary expression. * @param optag The operators tree tag. * @param arg The operator's argument. */ JCUnary makeUnary(JCTree.Tag optag, JCExpression arg) { JCUnary tree = make.Unary(optag, arg); tree.operator = operators.resolveUnary(tree, optag, arg.type); tree.type = tree.operator.type.getReturnType(); return tree; }
Example 4
Source File: Lower.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Make an attributed assignop expression. * @param optag The operators tree tag. * @param lhs The operator's left argument. * @param rhs The operator's right argument. */ JCAssignOp makeAssignop(JCTree.Tag optag, JCTree lhs, JCTree rhs) { JCAssignOp tree = make.Assignop(optag, lhs, rhs); tree.operator = operators.resolveBinary(tree, tree.getTag().noAssignOp(), lhs.type, rhs.type); tree.type = lhs.type; return tree; }
Example 5
Source File: Operators.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Entry point for resolving a binary operator given an operator tag and a pair of argument types. */ OperatorSymbol resolveBinary(DiagnosticPosition pos, JCTree.Tag tag, Type op1, Type op2) { return resolve(tag, binaryOperators, binop -> binop.test(op1, op2), binop -> binop.resolve(op1, op2), () -> reportErrorIfNeeded(pos, tag, op1, op2)); }
Example 6
Source File: JavaDynamicJdk_8.java From manifold with Apache License 2.0 | 5 votes |
public void setOperatorSymbol( Context ctx, JCTree.JCBinary cond, JCTree.Tag tag, String op, Symbol operandType ) { Symbol.OperatorSymbol operatorSym = (Symbol.OperatorSymbol)IDynamicJdk.instance().getMembers( Symtab.instance( ctx ).predefClass, (Symbol s) -> s instanceof Symbol.OperatorSymbol && s.name.toString().equals( op ) && ((Symbol.MethodSymbol)s).params().get( 0 ).type.tsym == operandType ) .iterator().next(); // should be just one setOperator( cond, operatorSym ); }
Example 7
Source File: ExtensionTransformer.java From manifold with Apache License 2.0 | 5 votes |
private String relOpString( JCTree.Tag tag ) { switch( tag ) { case LT: return "<"; case LE: return "<="; case GT: return ">"; case GE: return ">="; } throw new IllegalStateException( "Expecting only relational op, but found: " + tag ); }
Example 8
Source File: Operators.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Return name of operator with given tree tag. */ public Name operatorName(JCTree.Tag tag) { return opname[tag.operatorIndex()]; }
Example 9
Source File: TreePosTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Names for tree tags. */ private static String getTagName(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 10
Source File: CheckAttributedTree.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
String nameFromTag(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 11
Source File: TreePosTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Names for tree tags. */ private static String getTagName(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 12
Source File: Operators.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Return name of operator with given tree tag. */ public Name operatorName(JCTree.Tag tag) { return opname[tag.operatorIndex()]; }
Example 13
Source File: DeferredAttr.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
FilterScanner(final Set<JCTree.Tag> validTags) { this.treeFilter = t -> validTags.contains(t.getTag()); }
Example 14
Source File: Lower.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void visitUnary(JCUnary tree) { boolean isUpdateOperator = tree.getTag().isIncOrDecUnaryOp(); if (isUpdateOperator && !tree.arg.type.isPrimitive()) { switch(tree.getTag()) { case PREINC: // ++ e // translate to e += 1 case PREDEC: // -- e // translate to e -= 1 { JCTree.Tag opcode = (tree.hasTag(PREINC)) ? PLUS_ASG : MINUS_ASG; JCAssignOp newTree = makeAssignop(opcode, tree.arg, make.Literal(1)); result = translate(newTree, tree.type); return; } case POSTINC: // e ++ case POSTDEC: // e -- { result = translate(lowerBoxedPostop(tree), tree.type); return; } } throw new AssertionError(tree); } tree.arg = boxIfNeeded(translate(tree.arg, tree), tree.type); if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) { tree.type = cfolder.fold1(bool_not, tree.arg.type); } // If translated left hand side is an Apply, we are // seeing an access method invocation. In this case, return // that access method invocation as result. if (isUpdateOperator && tree.arg.hasTag(APPLY)) { result = tree.arg; } else { result = tree; } }
Example 15
Source File: CheckAttributedTree.java From hottub with GNU General Public License v2.0 | 4 votes |
String nameFromTag(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 16
Source File: TreePosTest.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Names for tree tags. */ private static String getTagName(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 17
Source File: CheckAttributedTree.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
String nameFromTag(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 18
Source File: CheckAttributedTree.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
String nameFromTag(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 19
Source File: TreePosTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Names for tree tags. */ private static String getTagName(JCTree.Tag tag) { String name = tag.name(); return (name == null) ? "??" : name; }
Example 20
Source File: IDynamicJdk.java From manifold with Apache License 2.0 | votes |
void setOperatorSymbol( Context ctx, JCTree.JCBinary expr, JCTree.Tag tag, String op, Symbol operandType );