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:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/ast/VariableInitializer.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript.ast; import org.mozilla.javascript.Token; /** * A variable declaration or initializer, part of a {@link VariableDeclaration} * expression. The variable "target" can be a simple name or a destructuring * form. The initializer, if present, can be any expression.<br> * * Node type is one of {@link Token#VAR}, {@link Token#CONST}, or * {@link Token#LET}. */ public class VariableInitializer extends AstNode { private AstNode target; private AstNode initializer; { type = Token.VAR; } /** * Sets the node type. * @throws IllegalArgumentException if {@code nodeType} is not one of * {@link Token#VAR}, {@link Token#CONST}, or {@link Token#LET} */ public void setNodeType(int nodeType) { if (nodeType != Token.VAR && nodeType != Token.CONST && nodeType != Token.LET) throw new IllegalArgumentException("invalid node type"); setType(nodeType); } public VariableInitializer() { } public VariableInitializer(int pos) { super(pos); } public VariableInitializer(int pos, int len) { super(pos, len); } /** * Returns true if this is a destructuring assignment. If so, the * initializer must be non-{@code null}. * @return {@code true} if the {@code target} field is a destructuring form * (an {@link ArrayLiteral} or {@link ObjectLiteral} node) */ public boolean isDestructuring() { return !(target instanceof Name); } /** * Returns the variable name or destructuring form */ public AstNode getTarget() { return target; } /** * Sets the variable name or destructuring form, and sets * its parent to this node. * @throws IllegalArgumentException if target is {@code null} */ public void setTarget(AstNode target) { // Don't throw exception if target is an "invalid" node type. // See mozilla/js/tests/js1_7/block/regress-350279.js if (target == null) throw new IllegalArgumentException("invalid target arg"); this.target = target; target.setParent(this); } /** * Returns the initial value, or {@code null} if not provided */ public AstNode getInitializer() { return initializer; } /** * Sets the initial value expression, and sets its parent to this node. * @param initializer the initial value. May be {@code null}. */ public void setInitializer(AstNode initializer) { this.initializer = initializer; if (initializer != null) initializer.setParent(this); } @Override public String toSource(int depth) { StringBuilder sb = new StringBuilder(); sb.append(makeIndent(depth)); sb.append(target.toSource(0)); if (initializer != null) { sb.append (" = "); sb.append(initializer.toSource(0)); } return sb.toString(); } /** * Visits this node, then the target expression, then the initializer * expression if present. */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); if (initializer != null) { initializer.visit(v); } } } }
⏎ org/mozilla/javascript/ast/VariableInitializer.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, 35985👍, 1💬
Popular Posts:
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was develo...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...
JDK 17 jdk.compiler.jmod is the JMOD file for JDK 17 Compiler tool, which can be invoked by the "jav...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...
MXP1 is a stable XmlPull parsing engine that is based on ideas from XPP and in particular XPP2 but c...