本文整理汇总了Java中jdk.nashorn.internal.ir.CaseNode类的典型用法代码示例。如果您正苦于以下问题:Java CaseNode类的具体用法?Java CaseNode怎么用?Java CaseNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CaseNode类属于jdk.nashorn.internal.ir包,在下文中一共展示了CaseNode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: enterCaseNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public boolean enterCaseNode(final CaseNode caseNode) {
enterDefault(caseNode);
type("SwitchCase");
comma();
final Node test = caseNode.getTest();
property("test");
if (test != null) {
test.accept(this);
} else {
nullValue();
}
comma();
array("consequent", caseNode.getBody().getStatements());
return leave();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JSONWriter.java
示例2: enterSwitchNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public boolean enterSwitchNode(final SwitchNode switchNode) {
final List<CaseNode> caseNodes = switchNode.getCases();
final List<CaseTreeImpl> caseTrees = new ArrayList<>(caseNodes.size());
for (final CaseNode caseNode : caseNodes) {
final Block body = caseNode.getBody();
caseTrees.add(
new CaseTreeImpl(caseNode,
translateExpr(caseNode.getTest()),
translateStats(body != null? body.getStatements() : null)));
}
curStat = new SwitchTreeImpl(switchNode,
translateExpr(switchNode.getExpression()),
caseTrees);
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:IRTranslator.java
示例3: enterSwitchNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public boolean enterSwitchNode(final SwitchNode switchNode) {
switchNode.toString(sb);
sb.append(" {");
final List<CaseNode> cases = switchNode.getCases();
for (final CaseNode caseNode : cases) {
sb.append(EOLN);
indent();
caseNode.toString(sb);
indent += TABWIDTH;
caseNode.getBody().accept(this);
indent -= TABWIDTH;
sb.append(EOLN);
}
sb.append(EOLN);
indent();
sb.append("}");
return false;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:24,代码来源:PrintVisitor.java
示例4: leaveSwitchNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public Node leaveSwitchNode(final SwitchNode switchNode) {
final boolean allInteger = switchNode.getTag().getSymbolType().isInteger();
if (allInteger) {
return switchNode;
}
final Expression expression = switchNode.getExpression();
final List<CaseNode> cases = switchNode.getCases();
final List<CaseNode> newCases = new ArrayList<>();
for (final CaseNode caseNode : cases) {
final Expression test = caseNode.getTest();
newCases.add(test != null ? caseNode.setTest(convert(test, Type.OBJECT)) : caseNode);
}
return switchNode.
setExpression(lc, convert(expression, Type.OBJECT)).
setCases(lc, newCases);
}
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:22,代码来源:FinalizeTypes.java
示例5: enterSwitchNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public boolean enterSwitchNode(final SwitchNode switchNode) {
switchNode.toString(sb, printTypes);
sb.append(" {");
final List<CaseNode> cases = switchNode.getCases();
for (final CaseNode caseNode : cases) {
sb.append(EOLN);
indent();
caseNode.toString(sb, printTypes);
printLocalVariableConversion(caseNode);
indent += TABWIDTH;
caseNode.getBody().accept(this);
indent -= TABWIDTH;
sb.append(EOLN);
}
if(switchNode.getLocalVariableConversion() != null) {
sb.append(EOLN);
indent();
sb.append("default: ");
printLocalVariableConversion(switchNode);
sb.append("{}");
}
sb.append(EOLN);
indent();
sb.append("}");
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:PrintVisitor.java
示例6: isUniqueIntegerSwitchNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
private static boolean isUniqueIntegerSwitchNode(final SwitchNode switchNode) {
final Set<Integer> alreadySeen = new HashSet<>();
for (final CaseNode caseNode : switchNode.getCases()) {
final Expression test = caseNode.getTest();
if (test != null && !isUniqueIntegerLiteral(test, alreadySeen)) {
return false;
}
}
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:FoldConstants.java
示例7: leaveCaseNode
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
@Override
public Node leaveCaseNode(final CaseNode caseNode) {
// Try to represent the case test as an integer
final Node test = caseNode.getTest();
if (test instanceof LiteralNode) {
final LiteralNode<?> lit = (LiteralNode<?>)test;
if (lit.isNumeric() && !(lit.getValue() instanceof Integer)) {
if (JSType.isRepresentableAsInt(lit.getNumber())) {
return caseNode.setTest((Expression)LiteralNode.newInstance(lit, lit.getInt32()).accept(this));
}
}
}
return caseNode;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Lower.java
示例8: CaseTreeImpl
import jdk.nashorn.internal.ir.CaseNode; //导入依赖的package包/类
public CaseTreeImpl(final CaseNode node,
final ExpressionTree expression,
final List<? extends StatementTree> statements) {
super(node);
this.expression = expression;
this.statements = statements;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:CaseTreeImpl.java
注:本文中的jdk.nashorn.internal.ir.CaseNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论