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


Java JCConditional类代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCConditional的典型用法代码示例。如果您正苦于以下问题:Java JCConditional类的具体用法?Java JCConditional怎么用?Java JCConditional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JCConditional类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCConditional类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: diffConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
protected int diffConditional(JCConditional oldT, JCConditional newT, int[] bounds) {
    int localPointer = bounds[0];
    // cond
    int[] condBounds = getBounds(oldT.cond);
    copyTo(localPointer, condBounds[0]);
    localPointer = diffTree(oldT.cond, newT.cond, condBounds);
    // true
    int[] trueBounds = getBounds(oldT.truepart);
    copyTo(localPointer, trueBounds[0]);
    localPointer = diffTree(oldT.truepart, newT.truepart, trueBounds);
    // false
    int[] falseBounds = getBounds(oldT.falsepart);
    copyTo(localPointer, falseBounds[0]);
    localPointer = diffTree(oldT.falsepart, newT.falsepart, falseBounds);
    copyTo(localPointer, bounds[1]);

    return bounds[1];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CasualDiff.java

示例2: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional tree) {
	print(tree.cond);
	print(" ? ");
	print(tree.truepart);
	print(" : ");
	print(tree.falsepart);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:PrettyPrinter.java

示例3: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional that) {
    try {
        print("JCConditional:");
    } catch (Exception e) {
    }
    super.visitConditional(that);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java

示例4: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
	try {
		open(prec, TreeInfo.condPrec);
		printExpr(tree.cond, TreeInfo.condPrec);
		print(" ? ");
		printExpr(tree.truepart, TreeInfo.condPrec);
		print(" : ");
		printExpr(tree.falsepart, TreeInfo.condPrec);
		close(prec, TreeInfo.condPrec);
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:14,代码来源:PrettyCommentsPrinter.java

示例5: inline

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public JCConditional inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().Conditional(
      getCondition().inline(inliner),
      getTrueExpression().inline(inliner), 
      getFalseExpression().inline(inliner));
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:8,代码来源:UConditional.java

示例6: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional tree) {
	printNode(tree);
	child("cond", tree.cond);
	child("truepart", tree.truepart);
	child("falsepart", tree.falsepart);
	indent--;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreePrinter.java

示例7: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override public void visitConditional(JCConditional node) {
	InlineIfExpression iie = new InlineIfExpression();
	iie.rawCondition(toTree(node.getCondition()));
	iie.rawIfTrue(toTree(node.getTrueExpression()));
	iie.rawIfFalse(toTree(node.getFalseExpression()));
	set(node, iie);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreeConverter.java

示例8: inline

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public JCConditional inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner
      .maker()
      .Conditional(
          getCondition().inline(inliner),
          getTrueExpression().inline(inliner),
          getFalseExpression().inline(inliner));
}
 
开发者ID:google,项目名称:error-prone,代码行数:10,代码来源:UConditional.java

示例9: visitConditionalExpression

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public Choice<State<JCConditional>> visitConditionalExpression(
    final ConditionalExpressionTree node, State<?> state) {
  return chooseSubtrees(
      state,
      s -> unifyExpression(node.getCondition(), s),
      s -> unifyExpression(node.getTrueExpression(), s),
      s -> unifyExpression(node.getFalseExpression(), s),
      maker()::Conditional);
}
 
开发者ID:google,项目名称:error-prone,代码行数:11,代码来源:PlaceholderUnificationVisitor.java

示例10: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
    try {
        open(prec, TreeInfo.condPrec);
        printExpr(tree.cond, TreeInfo.condPrec);
        print(" ? ");
        printExpr(tree.truepart, TreeInfo.condPrec);
        print(" : ");
        printExpr(tree.falsepart, TreeInfo.condPrec);
        close(prec, TreeInfo.condPrec);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:14,代码来源:Pretty.java

示例11: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
public void visitConditional(JCConditional tree) {
    attribExpr(tree.cond, env, syms.booleanType);
    attribExpr(tree.truepart, env);
    attribExpr(tree.falsepart, env);
    result = check(tree,
                   capture(condType(tree.pos(), tree.cond.type,
                                    tree.truepart.type, tree.falsepart.type)),
                   VAL, pkind, pt);
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:10,代码来源:Attr.java

示例12: createSimpleGetterBody

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
private List<JCStatement> createSimpleGetterBody(TreeMaker treeMaker, JavacNode field) {
	JCVariableDecl fieldDecl = (JCVariableDecl) field.get();
	JCExpression fieldRef = createFieldAccessor(treeMaker, field, FieldAccess.ALWAYS_FIELD);

	JCStatement returnExpression = null;
	
	String varTypeString = fieldDecl.vartype.toString();
	boolean isMutable = false;
	boolean isTypeCastNeeded = false;
	if (Timestamp.class.getSimpleName().equals(varTypeString) || Timestamp.class.getName().equals(varTypeString)) {
		isMutable = true;
		isTypeCastNeeded = true;
	} else if (varTypeString.endsWith("[]")) {
		isMutable = true;
	}
	
	if (isMutable) {
		JCExpression nullCheck = treeMaker.Binary(CTC_EQUAL, fieldRef, treeMaker.Literal(CTC_BOT, null));
		JCExpression callClone = treeMaker.Apply(List.<JCExpression>nil(), treeMaker.Select(fieldRef, field.toName("clone")), List.<JCExpression>nil());					
		if (isTypeCastNeeded) {
			callClone = treeMaker.TypeCast(
					fieldDecl.vartype,
					callClone
			);
		}
		
		JCConditional conditional = treeMaker.Conditional(
				nullCheck, 
				treeMaker.Literal(CTC_BOT, null), 
				callClone
		);
		
		returnExpression = treeMaker.Return(conditional);
	} else {
		returnExpression = treeMaker.Return(fieldRef);
	}
	
	return List.<JCStatement>of(returnExpression);
}
 
开发者ID:redundent,项目名称:lombok,代码行数:40,代码来源:HandleGetter.java

示例13: matchConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
private boolean matchConditional(JCConditional t1, JCConditional t2) {
    return treesMatch(t1.cond, t2.cond) && treesMatch(t1.truepart, t2.truepart) &&
           treesMatch(t1.falsepart, t2.falsepart);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CasualDiff.java

示例14: visitConditional

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
@Override
public void visitConditional(JCConditional that) {
    processArg(that, speculativeTree -> new ConditionalType(that, env, speculativeTree));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:ArgumentAttr.java

示例15: ConditionalType

import com.sun.tools.javac.tree.JCTree.JCConditional; //导入依赖的package包/类
ConditionalType(JCExpression tree, Env<AttrContext> env, JCConditional speculativeCond) {
    this(tree, env, speculativeCond, new HashMap<>());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ArgumentAttr.java


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