зеркало из https://github.com/mozilla/pjs.git
1. Consistently use ScriptRutime.<ClassName>Class instead of Classname.class to decrease code size and loading time
2. Small optimization in ScriptRuntime.toNuber
This commit is contained in:
Родитель
c71f9e5592
Коммит
3aafae2f86
|
@ -45,7 +45,7 @@ public abstract class ClassNameHelper {
|
|||
public static ClassNameHelper get(Context cx) {
|
||||
ClassNameHelper helper = savedNameHelper;
|
||||
if (helper == null && !helperNotAvailable) {
|
||||
Class nameHelperClass = ScriptRuntime.getClassOrNull(
|
||||
Class nameHelperClass = ScriptRuntime.classOrNull(
|
||||
"org.mozilla.javascript.optimizer.OptClassNameHelper");
|
||||
// nameHelperClass == null if running lite
|
||||
if (nameHelperClass != null) {
|
||||
|
|
|
@ -1742,7 +1742,7 @@ public class Context {
|
|||
// If Context was subclussed, cxClass != Context.class
|
||||
Class cxClass = this.getClass();
|
||||
// Check that Context or its suclass is accesible from this loader
|
||||
Class x = ScriptRuntime.getClassOrNull(loader, cxClass.getName());
|
||||
Class x = ScriptRuntime.classOrNull(loader, cxClass.getName());
|
||||
if (x != cxClass) {
|
||||
// The check covers the case when x == null =>
|
||||
// threadLoader does not know about Rhino or the case
|
||||
|
@ -1919,7 +1919,7 @@ public class Context {
|
|||
return errorCount == 0 ? result : null;
|
||||
}
|
||||
|
||||
private static Class codegenClass = ScriptRuntime.getClassOrNull(
|
||||
private static Class codegenClass = ScriptRuntime.classOrNull(
|
||||
"org.mozilla.javascript.optimizer.Codegen");
|
||||
|
||||
private Interpreter createCompiler() {
|
||||
|
@ -1991,7 +1991,7 @@ public class Context {
|
|||
|
||||
RegExpProxy getRegExpProxy() {
|
||||
if (regExpProxy == null) {
|
||||
Class cl = ScriptRuntime.getClassOrNull(
|
||||
Class cl = ScriptRuntime.classOrNull(
|
||||
"org.mozilla.javascript.regexp.RegExpImpl");
|
||||
if (cl != null) {
|
||||
regExpProxy = (RegExpProxy)ScriptRuntime.newInstanceOrNull(cl);
|
||||
|
@ -2076,7 +2076,7 @@ public class Context {
|
|||
private static Method threadLocalSet;
|
||||
|
||||
static {
|
||||
Class cl = ScriptRuntime.getClassOrNull("java.lang.ThreadLocal");
|
||||
Class cl = ScriptRuntime.classOrNull("java.lang.ThreadLocal");
|
||||
if (cl != null) {
|
||||
try {
|
||||
threadLocalGet = cl.getMethod("get", null);
|
||||
|
@ -2095,7 +2095,7 @@ public class Context {
|
|||
// Don't use "Thread.class": that performs the lookup
|
||||
// in the class initializer, which doesn't allow us to
|
||||
// catch possible security exceptions.
|
||||
Class threadClass = ScriptRuntime.getClassOrNull("java.lang.Thread");
|
||||
Class threadClass = ScriptRuntime.classOrNull("java.lang.Thread");
|
||||
if (threadClass != null) {
|
||||
try {
|
||||
method_getContextClassLoader =
|
||||
|
|
|
@ -138,7 +138,7 @@ public class FunctionObject extends BaseFunction {
|
|||
// Either variable args or an error.
|
||||
if (types[1].isArray()) {
|
||||
if (!isStatic ||
|
||||
types[0] != Context.class ||
|
||||
types[0] != ScriptRuntime.ContextClass ||
|
||||
types[1].getComponentType() != ScriptRuntime.ObjectClass ||
|
||||
types[2] != ScriptRuntime.FunctionClass ||
|
||||
types[3] != Boolean.TYPE)
|
||||
|
@ -149,7 +149,7 @@ public class FunctionObject extends BaseFunction {
|
|||
parmsLength = VARARGS_CTOR;
|
||||
} else {
|
||||
if (!isStatic ||
|
||||
types[0] != Context.class ||
|
||||
types[0] != ScriptRuntime.ContextClass ||
|
||||
types[1] != ScriptRuntime.ScriptableClass ||
|
||||
types[2].getComponentType() != ScriptRuntime.ObjectClass ||
|
||||
types[3] != ScriptRuntime.FunctionClass)
|
||||
|
@ -168,7 +168,7 @@ public class FunctionObject extends BaseFunction {
|
|||
type != ScriptRuntime.StringClass &&
|
||||
type != ScriptRuntime.BooleanClass &&
|
||||
!ScriptRuntime.NumberClass.isAssignableFrom(type) &&
|
||||
!Scriptable.class.isAssignableFrom(type) &&
|
||||
!ScriptRuntime.ScriptableClass.isAssignableFrom(type) &&
|
||||
type != Boolean.TYPE &&
|
||||
type != Byte.TYPE &&
|
||||
type != Short.TYPE &&
|
||||
|
@ -662,7 +662,7 @@ public class FunctionObject extends BaseFunction {
|
|||
|
||||
/** Get default master implementation or null if not available */
|
||||
private static Invoker newInvokerMaster() {
|
||||
Class cl = ScriptRuntime.getClassOrNull(INVOKER_MASTER_CLASS);
|
||||
Class cl = ScriptRuntime.classOrNull(INVOKER_MASTER_CLASS);
|
||||
if (cl != null) {
|
||||
return (Invoker)ScriptRuntime.newInstanceOrNull(cl);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class JavaAdapter extends ScriptableObject {
|
|||
}
|
||||
|
||||
if (superClass == null)
|
||||
superClass = Object.class;
|
||||
superClass = ScriptRuntime.ObjectClass;
|
||||
|
||||
Class[] interfaces = new Class[interfaceCount];
|
||||
System.arraycopy(intfs, 0, interfaces, 0, interfaceCount);
|
||||
|
@ -136,7 +136,7 @@ public class JavaAdapter extends ScriptableObject {
|
|||
generatedClasses.put(sig, adapterClass);
|
||||
}
|
||||
|
||||
Class[] ctorParms = { Scriptable.class };
|
||||
Class[] ctorParms = { ScriptRuntime.ScriptableClass };
|
||||
Object[] ctorArgs = { obj };
|
||||
Object adapter = adapterClass.getConstructor(ctorParms).newInstance(ctorArgs);
|
||||
return getAdapterSelf(adapterClass, adapter);
|
||||
|
@ -168,9 +168,11 @@ public class JavaAdapter extends ScriptableObject {
|
|||
}
|
||||
|
||||
try {
|
||||
Class[] ctorParms = { Scriptable.class, Scriptable.class };
|
||||
Class[] ctorParms = {
|
||||
ScriptRuntime.ScriptableClass,
|
||||
ScriptRuntime.ScriptableClass
|
||||
};
|
||||
Object[] ctorArgs = { obj, self };
|
||||
|
||||
return adapterClass.getConstructor(ctorParms).newInstance(ctorArgs);
|
||||
} catch(InstantiationException e) {
|
||||
} catch(IllegalAccessException e) {
|
||||
|
@ -311,8 +313,9 @@ public class JavaAdapter extends ScriptableObject {
|
|||
}
|
||||
Class[] parms = new Class[length];
|
||||
for (int k=0; k < length; k++)
|
||||
parms[k] = Object.class;
|
||||
generateMethod(cfw, adapterName, id, parms, Object.class);
|
||||
parms[k] = ScriptRuntime.ObjectClass;
|
||||
generateMethod(cfw, adapterName, id, parms,
|
||||
ScriptRuntime.ObjectClass);
|
||||
}
|
||||
}
|
||||
return cfw.toByteArray();
|
||||
|
|
|
@ -429,7 +429,7 @@ class JavaMembers {
|
|||
Method[] setMethods = setJavaMethod.getMethods();
|
||||
for (int pass = 1; pass <= 2 && setMethod == null; ++pass) {
|
||||
for (int i = 0; i < setMethods.length; ++i) {
|
||||
if (setMethods[i].getReturnType() == void.class &&
|
||||
if (setMethods[i].getReturnType() == Void.TYPE &&
|
||||
(!isStatic || Modifier.isStatic(setMethods[i].getModifiers())) &&
|
||||
(params = setMethods[i].getParameterTypes()) != null &&
|
||||
params.length == 1 ) {
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class LazilyLoadedCtor {
|
|||
// java.util.PropertyPermission
|
||||
// org.mozilla.javascript.JavaAdapter read
|
||||
|
||||
Class cl = ScriptRuntime.getClassOrNull(className);
|
||||
Class cl = ScriptRuntime.classOrNull(className);
|
||||
if (cl == null) {
|
||||
removeOnError = true;
|
||||
} else {
|
||||
|
|
|
@ -280,9 +280,9 @@ public class NativeJavaClass extends NativeJavaObject implements Function {
|
|||
// via system class loader which can be different from the
|
||||
// loader that brought Rhino classes that Class.forName() would
|
||||
// use, but ClassLoader.getSystemClassLoader() is Java 2 only
|
||||
return ScriptRuntime.getClassOrNull(nestedClassName);
|
||||
return ScriptRuntime.classOrNull(nestedClassName);
|
||||
} else {
|
||||
return ScriptRuntime.getClassOrNull(loader, nestedClassName);
|
||||
return ScriptRuntime.classOrNull(loader, nestedClassName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -292,9 +292,9 @@ public class NativeJavaPackage extends ScriptableObject {
|
|||
loader = cx.getApplicationClassLoader();
|
||||
}
|
||||
if (loader != null) {
|
||||
cl = ScriptRuntime.getClassOrNull(loader, className);
|
||||
cl = ScriptRuntime.classOrNull(loader, className);
|
||||
} else {
|
||||
cl = ScriptRuntime.getClassOrNull(className);
|
||||
cl = ScriptRuntime.classOrNull(className);
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
|
|
|
@ -66,27 +66,38 @@ public class ScriptRuntime {
|
|||
* that they won't cause problems by being loaded early.
|
||||
*/
|
||||
|
||||
public final static Class UndefinedClass = Undefined.class;
|
||||
public final static Class ScriptableClass = Scriptable.class;
|
||||
public final static Class StringClass = String.class;
|
||||
public final static Class NumberClass = Number.class;
|
||||
public final static Class BooleanClass = Boolean.class;
|
||||
public final static Class ByteClass = Byte.class;
|
||||
public final static Class ShortClass = Short.class;
|
||||
public final static Class IntegerClass = Integer.class;
|
||||
public final static Class LongClass = Long.class;
|
||||
public final static Class FloatClass = Float.class;
|
||||
public final static Class DoubleClass = Double.class;
|
||||
public final static Class CharacterClass = Character.class;
|
||||
public final static Class ObjectClass = Object.class;
|
||||
public final static Class FunctionClass = Function.class;
|
||||
public final static Class ClassClass = Class.class;
|
||||
public final static Class SerializableClass = java.io.Serializable.class;
|
||||
public final static Class DateClass = java.util.Date.class;
|
||||
|
||||
// Can not use .class as Comparable is only since JDK 1.2
|
||||
public final static Class
|
||||
ComparableClass = getClassOrNull("java.lang.Comparable");
|
||||
BooleanClass = classOrNull("java.lang.Boolean"),
|
||||
ByteClass = classOrNull("java.lang.Byte"),
|
||||
CharacterClass = classOrNull("java.lang.Character"),
|
||||
ClassClass = classOrNull("java.lang.Class"),
|
||||
DoubleClass = classOrNull("java.lang.Double"),
|
||||
FloatClass = classOrNull("java.lang.Float"),
|
||||
IntegerClass = classOrNull("java.lang.Integer"),
|
||||
LongClass = classOrNull("java.lang.Long"),
|
||||
NumberClass = classOrNull("java.lang.Number"),
|
||||
ObjectClass = classOrNull("java.lang.Object"),
|
||||
ShortClass = classOrNull("java.lang.Short"),
|
||||
StringClass = classOrNull("java.lang.String"),
|
||||
|
||||
SerializableClass = classOrNull("java.io.Serializable"),
|
||||
|
||||
DateClass = classOrNull("java.util.Date");
|
||||
|
||||
// It will be null under JDK 1.1 as Comparable is only since JDK 1.2
|
||||
public final static Class
|
||||
ComparableClass = classOrNull("java.lang.Comparable");
|
||||
|
||||
public final static Class
|
||||
ContextClass = classOrNull("org.mozilla.javascript.Context"),
|
||||
FunctionClass = classOrNull("org.mozilla.javascript.Function"),
|
||||
NativeGlobalClass = classOrNull("org.mozilla.javascript.NativeGlobal"),
|
||||
NativeScriptClass = classOrNull("org.mozilla.javascript.NativeScript"),
|
||||
NativeWithClass = classOrNull("org.mozilla.javascript.NativeWith"),
|
||||
ScriptableClass = classOrNull("org.mozilla.javascript.Scriptable"),
|
||||
ScriptableObjectClass = classOrNull(
|
||||
"org.mozilla.javascript.ScriptableObject"),
|
||||
UndefinedClass = classOrNull("org.mozilla.javascript.Undefined");
|
||||
|
||||
/**
|
||||
* Convert the value to a boolean.
|
||||
|
@ -283,18 +294,24 @@ public class ScriptRuntime {
|
|||
start++;
|
||||
}
|
||||
|
||||
if (startChar == '0' && start+2 < len &&
|
||||
Character.toLowerCase(s.charAt(start+1)) == 'x')
|
||||
if (startChar == '0') {
|
||||
if (start + 2 < len) {
|
||||
int c1 = s.charAt(start + 1);
|
||||
if (c1 == 'x' || c1 == 'X') {
|
||||
// A hexadecimal number
|
||||
return stringToNumber(s, start + 2, 16);
|
||||
|
||||
if ((startChar == '+' || startChar == '-') && start+3 < len &&
|
||||
s.charAt(start+1) == '0' &&
|
||||
Character.toLowerCase(s.charAt(start+2)) == 'x') {
|
||||
// A hexadecimal number
|
||||
}
|
||||
}
|
||||
} else if (startChar == '+' || startChar == '-') {
|
||||
if (start + 3 < len && s.charAt(start + 1) == '0') {
|
||||
int c2 = s.charAt(start + 2);
|
||||
if (c2 == 'x' || c2 == 'X') {
|
||||
// A hexadecimal number with sign
|
||||
double val = stringToNumber(s, start + 3, 16);
|
||||
return startChar == '-' ? -val : val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int end = len - 1;
|
||||
char endChar;
|
||||
|
@ -1188,19 +1205,19 @@ public class ScriptRuntime {
|
|||
String name = f.getFunctionName();
|
||||
if (name.length() == 4) {
|
||||
if (name.equals("eval")) {
|
||||
if (f.master.getClass() == NativeGlobal.class) {
|
||||
if (f.master.getClass() == NativeGlobalClass) {
|
||||
return NativeGlobal.evalSpecial(cx, scope,
|
||||
thisArg, args,
|
||||
filename, lineNumber);
|
||||
}
|
||||
}
|
||||
else if (name.equals("With")) {
|
||||
if (f.master.getClass() == NativeWith.class) {
|
||||
if (f.master.getClass() == NativeWithClass) {
|
||||
return NativeWith.newWithSpecial(cx, args, f, !isCall);
|
||||
}
|
||||
}
|
||||
else if (name.equals("exec")) {
|
||||
if (f.master.getClass() == NativeScript.class) {
|
||||
if (f.master.getClass() == NativeScriptClass) {
|
||||
return ((NativeScript)jsThis).
|
||||
exec(cx, ScriptableObject.getTopLevelScope(scope));
|
||||
}
|
||||
|
@ -1758,14 +1775,12 @@ public class ScriptRuntime {
|
|||
// Statements
|
||||
// ------------------
|
||||
|
||||
private static final String GLOBAL_CLASS =
|
||||
"org.mozilla.javascript.tools.shell.Global";
|
||||
|
||||
private static ScriptableObject getGlobal(Context cx) {
|
||||
Class globalClass = getClassOrNull(GLOBAL_CLASS);
|
||||
final String GLOBAL_CLASS = "org.mozilla.javascript.tools.shell.Global";
|
||||
Class globalClass = classOrNull(GLOBAL_CLASS);
|
||||
if (globalClass != null) {
|
||||
try {
|
||||
Class[] parm = { Context.class };
|
||||
Class[] parm = { ScriptRuntime.ContextClass };
|
||||
Constructor globalClassCtor = globalClass.getConstructor(parm);
|
||||
Object[] arg = { cx };
|
||||
return (ScriptableObject) globalClassCtor.newInstance(arg);
|
||||
|
@ -1961,7 +1976,7 @@ public class ScriptRuntime {
|
|||
cx.currentActivation = activation;
|
||||
}
|
||||
|
||||
static Class getClassOrNull(String className)
|
||||
static Class classOrNull(String className)
|
||||
{
|
||||
try {
|
||||
return Class.forName(className);
|
||||
|
@ -1974,7 +1989,7 @@ public class ScriptRuntime {
|
|||
return null;
|
||||
}
|
||||
|
||||
static Class getClassOrNull(ClassLoader loader, String className)
|
||||
static Class classOrNull(ClassLoader loader, String className)
|
||||
{
|
||||
try {
|
||||
return loader.loadClass(className);
|
||||
|
|
|
@ -605,8 +605,8 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
}
|
||||
if (val != null && (val == Undefined.instance ||
|
||||
!(val instanceof Scriptable) ||
|
||||
typeHint == Scriptable.class ||
|
||||
typeHint == Function.class))
|
||||
typeHint == ScriptRuntime.ScriptableClass ||
|
||||
typeHint == ScriptRuntime.FunctionClass))
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
@ -788,7 +788,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
continue;
|
||||
Class[] parmTypes = method.getParameterTypes();
|
||||
if (parmTypes.length == 3 &&
|
||||
parmTypes[0] == ContextClass &&
|
||||
parmTypes[0] == ScriptRuntime.ContextClass &&
|
||||
parmTypes[1] == ScriptRuntime.ScriptableClass &&
|
||||
parmTypes[2] == Boolean.TYPE &&
|
||||
Modifier.isStatic(method.getModifiers()))
|
||||
|
@ -1094,7 +1094,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
Class[] parmTypes = getter.getParameterTypes();
|
||||
if (parmTypes.length != 0) {
|
||||
if (parmTypes.length != 1 ||
|
||||
parmTypes[0] != ScriptableObject.class)
|
||||
parmTypes[0] != ScriptRuntime.ScriptableObjectClass)
|
||||
{
|
||||
throw PropertyException.withMessage1
|
||||
("msg.bad.getter.parms", getter.toString());
|
||||
|
@ -1112,7 +1112,7 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
}
|
||||
parmTypes = setter.getParameterTypes();
|
||||
if (parmTypes.length == 2) {
|
||||
if (parmTypes[0] != ScriptableObject.class) {
|
||||
if (parmTypes[0] != ScriptRuntime.ScriptableObjectClass) {
|
||||
throw PropertyException.withMessage0("msg.setter2.parms");
|
||||
}
|
||||
if (delegateTo == null) {
|
||||
|
@ -1794,6 +1794,4 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
setter = (Method) FunctionObject.readMember(in);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Class ContextClass = Context.class;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class Codegen extends Interpreter {
|
|||
}
|
||||
}
|
||||
if (superClass == null) {
|
||||
superClass = Object.class;
|
||||
superClass = ScriptRuntime.ObjectClass;
|
||||
}
|
||||
byte[] classFile = JavaAdapter.createAdapterCode(
|
||||
cx, obj, adapterClassName,
|
||||
|
|
|
@ -420,8 +420,10 @@ class Optimizer {
|
|||
if ((theVar != null) && theVar.isNumber()) {
|
||||
if (rType != TypeEvent.NumberType) {
|
||||
n.removeChild(rChild);
|
||||
Node newRChild = new Node(TokenStream.CONVERT, rChild);
|
||||
newRChild.putProp(Node.TYPE_PROP, Double.class);
|
||||
Node newRChild = new Node(TokenStream.CONVERT,
|
||||
rChild);
|
||||
newRChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.DoubleClass);
|
||||
n.addChildToBack(newRChild);
|
||||
}
|
||||
n.putIntProp(Node.ISNUMBER_PROP, Node.BOTH);
|
||||
|
@ -433,7 +435,8 @@ class Optimizer {
|
|||
if (!convertParameter(rChild)) {
|
||||
n.removeChild(rChild);
|
||||
Node newRChild = new Node(TokenStream.CONVERT, rChild);
|
||||
newRChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
newRChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToBack(newRChild);
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +458,8 @@ class Optimizer {
|
|||
if (!convertParameter(lChild)) {
|
||||
n.removeChild(lChild);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, lChild);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToFront(nuChild);
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +467,8 @@ class Optimizer {
|
|||
if (!convertParameter(rChild)) {
|
||||
n.removeChild(rChild);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, rChild);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToBack(nuChild);
|
||||
}
|
||||
}
|
||||
|
@ -579,7 +584,8 @@ class Optimizer {
|
|||
if (!convertParameter(rChild)) {
|
||||
n.removeChild(rChild);
|
||||
Node newRChild = new Node(TokenStream.CONVERT, rChild);
|
||||
newRChild.putProp(Node.TYPE_PROP, Double.class);
|
||||
newRChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.DoubleClass);
|
||||
n.addChildToBack(newRChild);
|
||||
n.putIntProp(Node.ISNUMBER_PROP, Node.BOTH);
|
||||
}
|
||||
|
@ -591,7 +597,8 @@ class Optimizer {
|
|||
if (!convertParameter(lChild)) {
|
||||
n.removeChild(lChild);
|
||||
Node newLChild = new Node(TokenStream.CONVERT, lChild);
|
||||
newLChild.putProp(Node.TYPE_PROP, Double.class);
|
||||
newLChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.DoubleClass);
|
||||
n.addChildToFront(newLChild);
|
||||
n.putIntProp(Node.ISNUMBER_PROP, Node.BOTH);
|
||||
}
|
||||
|
@ -601,13 +608,15 @@ class Optimizer {
|
|||
if (!convertParameter(lChild)) {
|
||||
n.removeChild(lChild);
|
||||
Node newLChild = new Node(TokenStream.CONVERT, lChild);
|
||||
newLChild.putProp(Node.TYPE_PROP, Double.class);
|
||||
newLChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.DoubleClass);
|
||||
n.addChildToFront(newLChild);
|
||||
}
|
||||
if (!convertParameter(rChild)) {
|
||||
n.removeChild(rChild);
|
||||
Node newRChild = new Node(TokenStream.CONVERT, rChild);
|
||||
newRChild.putProp(Node.TYPE_PROP, Double.class);
|
||||
newRChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.DoubleClass);
|
||||
n.addChildToBack(newRChild);
|
||||
}
|
||||
n.putIntProp(Node.ISNUMBER_PROP, Node.BOTH);
|
||||
|
@ -624,7 +633,8 @@ class Optimizer {
|
|||
if (!convertParameter(arrayBase)) {
|
||||
n.removeChild(arrayBase);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, arrayBase);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToFront(nuChild);
|
||||
}
|
||||
}
|
||||
|
@ -641,7 +651,8 @@ class Optimizer {
|
|||
if (!convertParameter(rValue)) {
|
||||
n.removeChild(rValue);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, rValue);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToBack(nuChild);
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +666,8 @@ class Optimizer {
|
|||
if (!convertParameter(arrayBase)) {
|
||||
n.removeChild(arrayBase);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, arrayBase);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
n.addChildToFront(nuChild);
|
||||
}
|
||||
}
|
||||
|
@ -704,7 +716,8 @@ class Optimizer {
|
|||
if (!convertParameter(child)) {
|
||||
n.removeChild(child);
|
||||
Node nuChild = new Node(TokenStream.CONVERT, child);
|
||||
nuChild.putProp(Node.TYPE_PROP, Object.class);
|
||||
nuChild.putProp(Node.TYPE_PROP,
|
||||
ScriptRuntime.ObjectClass);
|
||||
if (nextChild == null)
|
||||
n.addChildToBack(nuChild);
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче