Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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/IdFunctionObject.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/. */
// API class
package org.mozilla.javascript;
public class IdFunctionObject extends BaseFunction
{
private static final long serialVersionUID = -5332312783643935019L;
public IdFunctionObject(IdFunctionCall idcall, Object tag, int id, int arity)
{
if (arity < 0)
throw new IllegalArgumentException();
this.idcall = idcall;
this.tag = tag;
this.methodId = id;
this.arity = arity;
}
public IdFunctionObject(IdFunctionCall idcall, Object tag, int id,
String name, int arity, Scriptable scope)
{
super(scope, null);
if (arity < 0)
throw new IllegalArgumentException();
if (name == null)
throw new IllegalArgumentException();
this.idcall = idcall;
this.tag = tag;
this.methodId = id;
this.arity = arity;
this.functionName = name;
}
public void initFunction(String name, Scriptable scope)
{
if (name == null) throw new IllegalArgumentException();
if (scope == null) throw new IllegalArgumentException();
this.functionName = name;
setParentScope(scope);
}
public final boolean hasTag(Object tag)
{
return tag == null ? this.tag == null : tag.equals(this.tag);
}
public Object getTag() {
return tag;
}
public final int methodId()
{
return methodId;
}
public final void markAsConstructor(Scriptable prototypeProperty)
{
useCallAsConstructor = true;
setImmunePrototypeProperty(prototypeProperty);
}
public final void addAsProperty(Scriptable target)
{
ScriptableObject.defineProperty(target, functionName, this,
ScriptableObject.DONTENUM);
}
public void exportAsScopeProperty()
{
addAsProperty(getParentScope());
}
@Override
public Scriptable getPrototype()
{
// Lazy initialization of prototype: for native functions this
// may not be called at all
Scriptable proto = super.getPrototype();
if (proto == null) {
proto = getFunctionPrototype(getParentScope());
setPrototype(proto);
}
return proto;
}
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj,
Object[] args)
{
return idcall.execIdCall(this, cx, scope, thisObj, args);
}
@Override
public Scriptable createObject(Context cx, Scriptable scope)
{
if (useCallAsConstructor) {
return null;
}
// Throw error if not explicitly coded to be used as constructor,
// to satisfy ECMAScript standard (see bugzilla 202019).
// To follow current (2003-05-01) SpiderMonkey behavior, change it to:
// return super.createObject(cx, scope);
throw ScriptRuntime.typeErrorById("msg.not.ctor", functionName);
}
@Override
String decompile(int indent, int flags)
{
StringBuilder sb = new StringBuilder();
boolean justbody = (0 != (flags & Decompiler.ONLY_BODY_FLAG));
if (!justbody) {
sb.append("function ");
sb.append(getFunctionName());
sb.append("() { ");
}
sb.append("[native code for ");
if (idcall instanceof Scriptable) {
Scriptable sobj = (Scriptable)idcall;
sb.append(sobj.getClassName());
sb.append('.');
}
sb.append(getFunctionName());
sb.append(", arity=");
sb.append(getArity());
sb.append(justbody ? "]\n" : "] }\n");
return sb.toString();
}
@Override
public int getArity()
{
return arity;
}
@Override
public int getLength() { return getArity(); }
@Override
public String getFunctionName()
{
return (functionName == null) ? "" : functionName;
}
public final RuntimeException unknown()
{
// It is program error to call id-like methods for unknown function
return new IllegalArgumentException(
"BAD FUNCTION ID="+methodId+" MASTER="+idcall);
}
static boolean equalObjectGraphs(IdFunctionObject f1, IdFunctionObject f2, EqualObjectGraphs eq) {
return f1.methodId == f2.methodId && f1.hasTag(f2.tag) && eq.equalGraphs(f1.idcall, f2.idcall);
}
private final IdFunctionCall idcall;
private final Object tag;
private final int methodId;
private int arity;
private boolean useCallAsConstructor;
private String functionName;
}
⏎ org/mozilla/javascript/IdFunctionObject.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, ≈102🔥, 1💬
Popular Posts:
JDK 11 jdk.internal.vm.ci.jmod is the JMOD file for JDK 11 Internal VM CI module. JDK 11 Internal VM...
JDK 11 jdk.dynalink.jmod is the JMOD file for JDK 11 Dynamic Linking module. JDK 11 Dynamic Linking ...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...
JDK 17 jdk.jdi.jmod is the JMOD file for JDK 17 JDI (Java Debug Interface) tool. JDK 17 JDI tool com...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...