Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 jdk.scripting.nashorn.jmod - Scripting Nashorn Module
JDK 11 jdk.scripting.nashorn.jmod is the JMOD file for JDK 11 Scripting Nashorn module.
JDK 11 Scripting Nashorn module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.scripting.nashorn.jmod.
JDK 11 Scripting Nashorn module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Scripting Nashorn module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.scripting.nashorn.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nashorn/internal/ir/SwitchNode.java
/* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.nashorn.internal.ir; import java.util.ArrayList; import java.util.Collections; import java.util.List; import jdk.nashorn.internal.codegen.Label; import jdk.nashorn.internal.ir.annotations.Immutable; import jdk.nashorn.internal.ir.visitor.NodeVisitor; /** * IR representation of a SWITCH statement. */ @Immutable public final class SwitchNode extends BreakableStatement { private static final long serialVersionUID = 1L; /** Switch expression. */ private final Expression expression; /** Switch cases. */ private final List<CaseNode> cases; /** Switch default index. */ private final int defaultCaseIndex; /** True if all cases are 32-bit signed integer constants, without repetitions. It's a prerequisite for * using a tableswitch/lookupswitch when generating code. */ private final boolean uniqueInteger; /** Tag symbol. */ private final Symbol tag; /** * Constructor * * @param lineNumber lineNumber * @param token token * @param finish finish * @param expression switch expression * @param cases cases * @param defaultCase the default case node - null if none, otherwise has to be present in cases list */ public SwitchNode(final int lineNumber, final long token, final int finish, final Expression expression, final List<CaseNode> cases, final CaseNode defaultCase) { super(lineNumber, token, finish, new Label("switch_break")); this.expression = expression; this.cases = cases; this.defaultCaseIndex = defaultCase == null ? -1 : cases.indexOf(defaultCase); this.uniqueInteger = false; this.tag = null; } private SwitchNode(final SwitchNode switchNode, final Expression expression, final List<CaseNode> cases, final int defaultCaseIndex, final LocalVariableConversion conversion, final boolean uniqueInteger, final Symbol tag) { super(switchNode, conversion); this.expression = expression; this.cases = cases; this.defaultCaseIndex = defaultCaseIndex; this.tag = tag; this.uniqueInteger = uniqueInteger; } @Override public Node ensureUniqueLabels(final LexicalContext lc) { final List<CaseNode> newCases = new ArrayList<>(); for (final CaseNode caseNode : cases) { newCases.add(new CaseNode(caseNode, caseNode.getTest(), caseNode.getBody(), caseNode.getLocalVariableConversion())); } return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, newCases, defaultCaseIndex, conversion, uniqueInteger, tag)); } @Override public boolean isTerminal() { //there must be a default case, and that including all other cases must terminate if (!cases.isEmpty() && defaultCaseIndex != -1) { for (final CaseNode caseNode : cases) { if (!caseNode.isTerminal()) { return false; } } return true; } return false; } @Override public Node accept(final LexicalContext lc, final NodeVisitor<? extends LexicalContext> visitor) { if (visitor.enterSwitchNode(this)) { return visitor.leaveSwitchNode( setExpression(lc, (Expression)expression.accept(visitor)). setCases(lc, Node.accept(visitor, cases), defaultCaseIndex)); } return this; } @Override public void toString(final StringBuilder sb, final boolean printType) { sb.append("switch ("); expression.toString(sb, printType); sb.append(')'); } /** * Return the case node that is default case * @return default case or null if none */ public CaseNode getDefaultCase() { return defaultCaseIndex == -1 ? null : cases.get(defaultCaseIndex); } /** * Get the cases in this switch * @return a list of case nodes */ public List<CaseNode> getCases() { return Collections.unmodifiableList(cases); } /** * Replace case nodes with new list. the cases have to be the same * and the default case index the same. This is typically used * by NodeVisitors who perform operations on every case node * @param lc lexical context * @param cases list of cases * @return new switch node or same if no state was changed */ public SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases) { return setCases(lc, cases, defaultCaseIndex); } private SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases, final int defaultCaseIndex) { if (this.cases == cases) { return this; } return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger, tag)); } /** * Set or reset the list of cases in this switch * @param lc lexical context * @param cases a list of cases, case nodes * @param defaultCase a case in the list that is the default - must be in the list or class will assert * @return new switch node or same if no state was changed */ public SwitchNode setCases(final LexicalContext lc, final List<CaseNode> cases, final CaseNode defaultCase) { return setCases(lc, cases, defaultCase == null ? -1 : cases.indexOf(defaultCase)); } /** * Return the expression to switch on * @return switch expression */ public Expression getExpression() { return expression; } /** * Set or reset the expression to switch on * @param lc lexical context * @param expression switch expression * @return new switch node or same if no state was changed */ public SwitchNode setExpression(final LexicalContext lc, final Expression expression) { if (this.expression == expression) { return this; } return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger, tag)); } /** * Get the tag symbol for this switch. The tag symbol is where * the switch expression result is stored * @return tag symbol */ public Symbol getTag() { return tag; } /** * Set the tag symbol for this switch. The tag symbol is where * the switch expression result is stored * @param lc lexical context * @param tag a symbol * @return a switch node with the symbol set */ public SwitchNode setTag(final LexicalContext lc, final Symbol tag) { if (this.tag == tag) { return this; } return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger, tag)); } /** * Returns true if all cases of this switch statement are 32-bit signed integer constants, without repetitions. * @return true if all cases of this switch statement are 32-bit signed integer constants, without repetitions. */ public boolean isUniqueInteger() { return uniqueInteger; } /** * Sets whether all cases of this switch statement are 32-bit signed integer constants, without repetitions. * @param lc lexical context * @param uniqueInteger if true, all cases of this switch statement have been determined to be 32-bit signed * integer constants, without repetitions. * @return this switch node, if the value didn't change, or a new switch node with the changed value */ public SwitchNode setUniqueInteger(final LexicalContext lc, final boolean uniqueInteger) { if(this.uniqueInteger == uniqueInteger) { return this; } return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger, tag)); } @Override JoinPredecessor setLocalVariableConversionChanged(final LexicalContext lc, final LocalVariableConversion conversion) { return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger, tag)); } }
⏎ jdk/nashorn/internal/ir/SwitchNode.java
Or download all of them as a single archive file:
File name: jdk.scripting.nashorn-11.0.1-src.zip File size: 1390965 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.scripting.nashorn.shell.jmod - Scripting Nashorn Shell Module
2020-04-25, 83871👍, 0💬
Popular Posts:
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...
Apache Log4j IOStreams is a Log4j API extension that provides numerous classes from java.io that can...
What Is jaxb-impl-2.1.12.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Jav...
How to display types defined in an XML Schema file with the xs\QueryXS.java provided in the Apache X...
XMLSchema, Release 1.4.2, is a lightweight Java object model that can be used to manipulate and gene...