• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JCLabeledStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visitLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
public void visitLabelled(JCLabeledStatement tree) {
	try {
		print(tree.label + ":");
		if (isEmptyStat(tree.body) || tree.body instanceof JCSkip) {
			print(" ;");
		} else if (tree.body instanceof JCBlock) {
			print(" ");
			printStat(tree.body);
		} else {
			println();
			align();
			printStat(tree.body);
		}
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:18,代码来源:PrettyCommentsPrinter.java


示例2: visitLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
public void visitLabelled(JCLabeledStatement tree) {
    // Check that label is not used in an enclosing statement
    Env<AttrContext> env1 = env;
    while (env1 != null && env1.tree.getTag() != JCTree.CLASSDEF) {
        if (env1.tree.getTag() == JCTree.LABELLED &&
            ((JCLabeledStatement) env1.tree).label == tree.label) {
            log.error(tree.pos(), "label.already.in.use",
                      tree.label);
            break;
        }
        env1 = env1.next;
    }

    attribStat(tree.body, env.dup(tree));
    result = null;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:17,代码来源:Attr.java


示例3: diffLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
protected int diffLabelled(JCLabeledStatement oldT, JCLabeledStatement newT, int[] bounds) {
    int localPointer = bounds[0];
    if (nameChanged(oldT.label, newT.label)) {
        copyTo(localPointer, localPointer = getOldPos(oldT));
        printer.print(newT.label);
        localPointer += oldT.label.length();
    }
    int[] bodyBounds = getBounds(oldT.body);
    copyTo(localPointer, bodyBounds[0]);
    localPointer = diffTree(oldT.body, newT.body, bodyBounds);
    copyTo(localPointer, bounds[1]);

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


示例4: visitLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
@Override public void visitLabelled(JCLabeledStatement tree) {
	aPrint(tree.label);
	print(":");
	if (tree.body instanceof JCSkip || suppress(tree)) {
		println(" ;", tree);
	} else if (tree.body instanceof JCBlock) {
		print(" ");
		print(tree.body);
	} else {
		println(tree);
		print(tree.body);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PrettyPrinter.java


示例5: visitLabelled

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


示例6: visitLabeledStatement

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
@Override
public Choice<State<JCLabeledStatement>> visitLabeledStatement(
    final LabeledStatementTree node, State<?> state) {
  return chooseSubtrees(
      state,
      s -> unifyStatement(node.getStatement(), s),
      stmt -> maker().Labelled((Name) node.getLabel(), stmt));
}
 
开发者ID:google,项目名称:error-prone,代码行数:9,代码来源:PlaceholderUnificationVisitor.java


示例7: visitLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
public void visitLabelled(JCLabeledStatement tree) {
    try {
        print(tree.label + ": ");
        printStat(tree.body);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:9,代码来源:Pretty.java


示例8: matchLabelled

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


示例9: Labelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
public JCLabeledStatement Labelled(Name label, JCStatement body) {
	return invoke(Labelled, label, body);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java


示例10: AJCLabeledStatement

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
public AJCLabeledStatement(JCLabeledStatement ltree) {
    super(ltree.label, ltree.body);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCLabeledStatement.java


示例11: visitLabelled

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


示例12: visitLabelled

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
@Override public void visitLabelled(JCLabeledStatement node) {
	Identifier lbl = new Identifier().astValue(node.getLabel().toString());
	set(node, new LabelledStatement().rawStatement(toTree(node.getStatement())).astLabel(lbl));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:5,代码来源:JcTreeConverter.java


示例13: inline

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
@Override
public JCLabeledStatement inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner
      .maker()
      .Labelled(inlineLabel(getLabel(), inliner), getStatement().inline(inliner));
}
 
开发者ID:google,项目名称:error-prone,代码行数:7,代码来源:ULabeledStatement.java


示例14: findJumpTarget

import com.sun.tools.javac.tree.JCTree.JCLabeledStatement; //导入依赖的package包/类
/** Return the target of a break or continue statement, if it exists,
 *  report an error if not.
 *  Note: The target of a labelled break or continue is the
 *  (non-labelled) statement tree referred to by the label,
 *  not the tree representing the labelled statement itself.
 *
 *  @param pos     The position to be used for error diagnostics
 *  @param tag     The tag of the jump statement. This is either
 *                 Tree.BREAK or Tree.CONTINUE.
 *  @param label   The label of the jump statement, or null if no
 *                 label is given.
 *  @param env     The environment current at the jump statement.
 */
private JCTree findJumpTarget(DiagnosticPosition pos,
                            int tag,
                            Name label,
                            Env<AttrContext> env) {
    // Search environments outwards from the point of jump.
    Env<AttrContext> env1 = env;
    LOOP:
    while (env1 != null) {
        switch (env1.tree.getTag()) {
        case JCTree.LABELLED:
            JCLabeledStatement labelled = (JCLabeledStatement)env1.tree;
            if (label == labelled.label) {
                // If jump is a continue, check that target is a loop.
                if (tag == JCTree.CONTINUE) {
                    if (labelled.body.getTag() != JCTree.DOLOOP &&
                        labelled.body.getTag() != JCTree.WHILELOOP &&
                        labelled.body.getTag() != JCTree.FORLOOP &&
                        labelled.body.getTag() != JCTree.FOREACHLOOP)
                        log.error(pos, "not.loop.label", label);
                    // Found labelled statement target, now go inwards
                    // to next non-labelled tree.
                    return TreeInfo.referencedStatement(labelled);
                } else {
                    return labelled;
                }
            }
            break;
        case JCTree.DOLOOP:
        case JCTree.WHILELOOP:
        case JCTree.FORLOOP:
        case JCTree.FOREACHLOOP:
            if (label == null) return env1.tree;
            break;
        case JCTree.SWITCH:
            if (label == null && tag == JCTree.BREAK) return env1.tree;
            break;
        case JCTree.METHODDEF:
        case JCTree.CLASSDEF:
            break LOOP;
        default:
        }
        env1 = env1.next;
    }
    if (label != null)
        log.error(pos, "undef.label", label);
    else if (tag == JCTree.CONTINUE)
        log.error(pos, "cont.outside.loop");
    else
        log.error(pos, "break.outside.switch.loop");
    return null;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:65,代码来源:Attr.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamReaderBufferProcessor类代码示例发布时间:2022-05-23
下一篇:
Java CMStateSet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap