Dead code cleanup

This commit is contained in:
szegedia%freemail.hu 2006-08-07 15:24:00 +00:00
parent 92f283562b
commit 38ad1ba641
27 changed files with 80 additions and 138 deletions

View File

@ -2514,7 +2514,6 @@ public class ClassFileWriter {
private static final boolean DEBUGSTACK = false;
private static final boolean DEBUGLABELS = false;
private static final boolean DEBUGCODE = false;
private static final int CodeBufferSize = 128;
private String generatedClassName;
@ -2529,8 +2528,6 @@ public class ClassFileWriter {
private ConstantPool itsConstantPool;
private short itsSourceFileAttributeIndex;
private ClassFileMethod itsCurrentMethod;
private short itsStackTop;
@ -2966,7 +2963,6 @@ final class ConstantPool
private ObjToIntMap itsUtf8Hash = new ObjToIntMap();
private ObjToIntMap itsFieldRefHash = new ObjToIntMap();
private ObjToIntMap itsMethodRefHash = new ObjToIntMap();
private UintMap nameAndTypeHash = new UintMap();
private ObjToIntMap itsClassHash = new ObjToIntMap();
private int itsTop;

View File

@ -231,8 +231,6 @@ final class Arguments extends IdScriptableObject
NativeCall caller = activation.parentActivationCall;
if (caller != null) {
value = caller.get("arguments", caller);
} else {
value = null;
}
}
return value;

View File

@ -2286,10 +2286,9 @@ public class Context
Object result;
if (returnFunction) {
result = compiler.createFunctionObject(this, scope, bytecode,
securityDomain);
result = compiler.createFunctionObject(this, scope, securityDomain);
} else {
result = compiler.createScriptObject(bytecode, securityDomain);
result = compiler.createScriptObject(securityDomain);
}
return result;

View File

@ -204,7 +204,7 @@ class DToA {
z = d0 & Frac_mask;
d0 &= 0x7fffffff; /* clear sign bit, which we ignore */
if ((de = (int)(d0 >>> Exp_shift)) != 0)
if ((de = (d0 >>> Exp_shift)) != 0)
z |= Exp_msk1;
if ((y = d1) != 0) {
@ -302,7 +302,6 @@ class DToA {
char[] buffer; /* The output string */
int p; /* index to current position in the buffer */
int q;
int digit;
double df; /* The fractional part of d */
BigInteger b;
@ -554,7 +553,7 @@ class DToA {
}
b = d2b(d, be, bbits);
if ((i = (int)(word0(d) >>> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) {
if ((i = (word0(d) >>> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) {
d2 = setWord0(d, (word0(d) & Frac_mask1) | Exp_11);
/* log(x) ~=~ log(1.5) + (x-1.5)/1.5
* log10(x) = log(x) / log(10)
@ -1188,7 +1187,6 @@ class DToA {
boolean exponentialNotation = false;
int minNDigits = 0; /* Minimum number of significand digits required by mode and precision */
int p;
int q;
switch (mode) {
case DTOSTR_STANDARD:

View File

@ -862,7 +862,7 @@ public class Decompiler
lbits = (long)source.charAt(offset) << 48;
lbits |= (long)source.charAt(offset + 1) << 32;
lbits |= (long)source.charAt(offset + 2) << 16;
lbits |= (long)source.charAt(offset + 3);
lbits |= source.charAt(offset + 3);
if (type == 'J') {
number = lbits;
} else {

View File

@ -506,7 +506,6 @@ final class IRFactory
Node createForIn(Node loop, Node lhs, Node obj, Node body,
boolean isForEach)
{
String name;
int type = lhs.getType();
Node lvalue;

View File

@ -70,7 +70,6 @@ public abstract class IdScriptableObject extends ScriptableObject
private static final int SLOT_SPAN = 2;
private IdScriptableObject obj;
private Object tag;
private int maxId;
private volatile Object[] valueArray;
private volatile short[] attributeArray;

View File

@ -129,7 +129,6 @@ public class InterfaceAdapter
Object[] args)
{
int N = (args == null) ? 0 : args.length;
String methodName = method.getName();
Callable function = (Callable)target;
Scriptable thisObj = topScope;

View File

@ -461,19 +461,15 @@ public class Interpreter
return itsData;
}
public Script createScriptObject(Object bytecode,
Object staticSecurityDomain)
public Script createScriptObject(Object staticSecurityDomain)
{
InterpreterData idata = (InterpreterData)bytecode;
return InterpretedFunction.createScript(itsData,
staticSecurityDomain);
}
public Function createFunctionObject(Context cx, Scriptable scope,
Object bytecode,
Object staticSecurityDomain)
public Function createFunctionObject(Context cx, Scriptable scope,
Object staticSecurityDomain)
{
InterpreterData idata = (InterpreterData)bytecode;
return InterpretedFunction.createFunction(cx, scope, itsData,
staticSecurityDomain);
}
@ -686,7 +682,6 @@ public class Interpreter
// See comments in IRFactory.createSwitch() for description
// of SWITCH node
{
Node switchNode = (Node.Jump)node;
visitExpression(child, 0);
for (Node.Jump caseNode = (Node.Jump)child.getNext();
caseNode != null;
@ -2414,9 +2409,6 @@ public class Interpreter
// restart the execution
}
// Should be already cleared
if (throwable != null) Kit.codeBug();
} else {
if (frame.frozen) Kit.codeBug();
}

View File

@ -456,8 +456,6 @@ public class NativeArray extends IdScriptableObject
return ((NativeString)obj).getLength();
} else if (obj instanceof NativeArray) {
return ((NativeArray)obj).getLength();
} else if (!(obj instanceof Scriptable)) {
return 0;
}
return ScriptRuntime.toUint32(
ScriptRuntime.getObjectProp(obj, "length", cx));
@ -565,8 +563,7 @@ public class NativeArray extends IdScriptableObject
}
} else {
if (toLocale && elem != Undefined.instance &&
elem != null)
if (toLocale)
{
Callable fun;
Scriptable funThis;
@ -947,7 +944,6 @@ public class NativeArray extends IdScriptableObject
private static Object js_unshift(Context cx, Scriptable thisObj,
Object[] args)
{
Object result;
long length = getLengthProperty(cx, thisObj);
int argc = args.length;

View File

@ -439,11 +439,6 @@ final class NativeDate extends IdScriptableObject
return lo;
}
private static boolean InLeapYear(double t)
{
return IsLeapYear(YearFromTime(t));
}
private static double DayFromMonth(int m, int year)
{
int day = m * 30;
@ -547,7 +542,7 @@ final class NativeDate extends IdScriptableObject
private static double now()
{
return (double) System.currentTimeMillis();
return System.currentTimeMillis();
}
/* Should be possible to determine the need for this dynamically

View File

@ -192,8 +192,7 @@ public class NativeJavaClass extends NativeJavaObject implements Function
if (v != NOT_FOUND) {
Function f = (Function) v;
Object[] adapterArgs = { this, args[0] };
return (Scriptable) f.construct(cx, topLevel,
adapterArgs);
return f.construct(cx, topLevel,adapterArgs);
}
} catch (Exception ex) {
// fall through to error
@ -210,7 +209,6 @@ public class NativeJavaClass extends NativeJavaObject implements Function
Object[] args, MemberBox ctor)
{
Scriptable topLevel = ScriptableObject.getTopLevelScope(scope);
Class classObject = ctor.getDeclaringClass();
Class[] argTypes = ctor.argTypes;
Object[] origArgs = args;

View File

@ -707,8 +707,8 @@ WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
}
return new Character((char)toInteger(value,
ScriptRuntime.CharacterClass,
(double)Character.MIN_VALUE,
(double)Character.MAX_VALUE));
Character.MIN_VALUE,
Character.MAX_VALUE));
}
// Double, Float
@ -731,10 +731,10 @@ WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
}
else {
double absNumber = Math.abs(number);
if (absNumber < (double)Float.MIN_VALUE) {
if (absNumber < Float.MIN_VALUE) {
return new Float((number > 0.0) ? +0.0 : -0.0);
}
else if (absNumber > (double)Float.MAX_VALUE) {
else if (absNumber > Float.MAX_VALUE) {
return new Float((number > 0.0) ?
Float.POSITIVE_INFINITY :
Float.NEGATIVE_INFINITY);
@ -754,8 +754,8 @@ WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
else {
return new Integer((int)toInteger(value,
ScriptRuntime.IntegerClass,
(double)Integer.MIN_VALUE,
(double)Integer.MAX_VALUE));
Integer.MIN_VALUE,
Integer.MAX_VALUE));
}
}
@ -787,8 +787,8 @@ WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
else {
return new Short((short)toInteger(value,
ScriptRuntime.ShortClass,
(double)Short.MIN_VALUE,
(double)Short.MAX_VALUE));
Short.MIN_VALUE,
Short.MAX_VALUE));
}
}
@ -799,8 +799,8 @@ WrapFactory#wrap(Context cx, Scriptable scope, Object obj, Class)}
else {
return new Byte((byte)toInteger(value,
ScriptRuntime.ByteClass,
(double)Byte.MIN_VALUE,
(double)Byte.MAX_VALUE));
Byte.MIN_VALUE,
Byte.MAX_VALUE));
}
}

View File

@ -216,7 +216,7 @@ final class NativeMath extends IdScriptableObject
// Round only finite x
long l = Math.round(x);
if (l != 0) {
x = (double)l;
x = l;
} else {
// We must propagate the sign of d into the result
if (x < 0.0) {

View File

@ -258,7 +258,7 @@ public class Parser
loopAndSwitchSet.pop();
}
private Node enterSwitch(Node switchSelector, int lineno, Node switchLabel)
private Node enterSwitch(Node switchSelector, int lineno)
{
Node switchNode = nf.createSwitch(switchSelector, lineno);
if (loopAndSwitchSet == null) {
@ -493,7 +493,6 @@ public class Parser
loopAndSwitchSet = null;
Node body;
String source;
try {
decompiler.addToken(Token.LP);
if (!matchToken(Token.RP)) {
@ -681,7 +680,7 @@ public class Parser
int lineno = ts.getLineno();
mustMatchToken(Token.LP, "msg.no.paren.switch");
decompiler.addToken(Token.LP);
pn = enterSwitch(expr(false), lineno, statementLabel);
pn = enterSwitch(expr(false), lineno);
try {
mustMatchToken(Token.RP, "msg.no.paren.after.switch");
decompiler.addToken(Token.RP);

View File

@ -1236,8 +1236,8 @@ public class ScriptRuntime {
static Object getIndexObject(double d)
{
int i = (int)d;
if ((double)i == d) {
return new Integer((int)i);
if (i == d) {
return new Integer(i);
}
return toString(d);
}
@ -1252,7 +1252,7 @@ public class ScriptRuntime {
if (id instanceof Number) {
double d = ((Number)id).doubleValue();
int index = (int)d;
if (((double)index) == d) {
if (index == d) {
storeIndexResult(cx, index);
return null;
}
@ -1352,7 +1352,7 @@ public class ScriptRuntime {
}
int index = (int)dblIndex;
if ((double)index == dblIndex) {
if (index == dblIndex) {
return getObjectIndex(sobj, index, cx);
} else {
String s = toString(dblIndex);
@ -1447,7 +1447,7 @@ public class ScriptRuntime {
}
int index = (int)dblIndex;
if ((double)index == dblIndex) {
if (index == dblIndex) {
return setObjectIndex(sobj, index, value, cx);
} else {
String s = toString(dblIndex);
@ -2940,12 +2940,10 @@ public class ScriptRuntime {
errorObject, "javaException", wrap,
ScriptableObject.PERMANENT | ScriptableObject.READONLY);
}
if (re != null) {
Object wrap = cx.getWrapFactory().wrap(cx, scope, re, null);
ScriptableObject.defineProperty(
errorObject, "rhinoException", wrap,
ScriptableObject.PERMANENT | ScriptableObject.READONLY);
}
Object wrap = cx.getWrapFactory().wrap(cx, scope, re, null);
ScriptableObject.defineProperty(
errorObject, "rhinoException", wrap,
ScriptableObject.PERMANENT | ScriptableObject.READONLY);
obj = errorObject;
}

View File

@ -1358,9 +1358,6 @@ class TokenStream
String regExpFlags;
private String line;
private boolean fromEval;
// Set this to an inital non-null value so that the Parser has
// something to retrieve even if an error has occured and no
// string is found. Fosters one class of error, but saves lots of

View File

@ -83,7 +83,7 @@ public class WrapFactory
if (staticType == Void.TYPE)
return Undefined.instance;
if (staticType == Character.TYPE)
return new Integer((int) ((Character) obj).charValue());
return new Integer(((Character) obj).charValue());
return obj;
}
if (!isJavaPrimitiveWrap()) {

View File

@ -568,11 +568,6 @@ class Block
return changed;
}
private boolean isLiveOnEntry(int index)
{
return (itsLiveOnEntrySet != null) && (itsLiveOnEntrySet.test(index));
}
private void printLiveOnEntrySet(OptFunctionNode fn)
{
if (DEBUG) {

View File

@ -110,7 +110,7 @@ public class ClassCompiler
*/
public Class[] getTargetImplements()
{
return targetImplements;
return targetImplements == null ? null : (Class[])targetImplements.clone();
}
/**
@ -121,7 +121,7 @@ public class ClassCompiler
*/
public void setTargetImplements(Class[] implementsClasses)
{
targetImplements = implementsClasses;
targetImplements = implementsClasses == null ? null : (Class[])implementsClasses.clone();
}
/**

View File

@ -198,7 +198,7 @@ public class Codegen extends Interpreter
ot.transform(tree);
if (optLevel > 0) {
(new Optimizer()).optimize(tree, optLevel);
(new Optimizer()).optimize(tree);
}
}
@ -261,11 +261,10 @@ public class Codegen extends Interpreter
}
if (hasScript) {
ScriptOrFnNode script = scriptOrFnNodes[0];
cfw.addInterface("org/mozilla/javascript/Script");
generateScriptCtor(cfw, script);
generateScriptCtor(cfw);
generateMain(cfw);
generateExecute(cfw, script);
generateExecute(cfw);
}
generateCallMethod(cfw);
@ -504,7 +503,7 @@ public class Codegen extends Interpreter
cfw.stopMethod((short)1);
}
private void generateExecute(ClassFileWriter cfw, ScriptOrFnNode script)
private void generateExecute(ClassFileWriter cfw)
{
cfw.startMethod("exec",
"(Lorg/mozilla/javascript/Context;"
@ -535,8 +534,7 @@ public class Codegen extends Interpreter
cfw.stopMethod((short)3);
}
private void generateScriptCtor(ClassFileWriter cfw,
ScriptOrFnNode script)
private void generateScriptCtor(ClassFileWriter cfw)
{
cfw.startMethod("<init>", "()V", ClassFileWriter.ACC_PUBLIC);
@ -1035,7 +1033,6 @@ public class Codegen extends Interpreter
private static String getStaticConstantWrapperType(double num)
{
String constantType;
int inum = (int)num;
if (inum == num) {
return "Ljava/lang/Integer;";
@ -1151,9 +1148,6 @@ public class Codegen extends Interpreter
String mainClassName;
String mainClassSignature;
boolean itsUseDynamicScope;
int languageVersion;
private double[] itsConstantList;
private int itsConstantListSize;
}
@ -1178,7 +1172,7 @@ class BodyCodegen
} else {
treeTop = scriptOrFn;
}
generateStatement(treeTop, null);
generateStatement(treeTop);
generateEpilogue();
@ -1491,7 +1485,7 @@ class BodyCodegen
"(Lorg/mozilla/javascript/Context;)V");
}
private void generateStatement(Node node, Node parent)
private void generateStatement(Node node)
{
// System.out.println("gen code for " + node.toString());
@ -1507,7 +1501,7 @@ class BodyCodegen
case Token.EMPTY:
// no-ops.
while (child != null) {
generateStatement(child, node);
generateStatement(child);
child = child.getNext();
}
break;
@ -1516,7 +1510,7 @@ class BodyCodegen
int local = getNewWordLocal();
node.putIntProp(Node.LOCAL_PROP, local);
while (child != null) {
generateStatement(child, node);
generateStatement(child);
child = child.getNext();
}
releaseWordLocal((short)local);
@ -1693,7 +1687,7 @@ class BodyCodegen
int finallyRegister = getNewWordLocal();
cfw.addAStore(finallyRegister);
while (child != null) {
generateStatement(child, node);
generateStatement(child);
child = child.getNext();
}
cfw.add(ByteCode.RET, finallyRegister);
@ -1921,7 +1915,7 @@ class BodyCodegen
case Token.INC:
case Token.DEC:
visitIncDec(node, false);
visitIncDec(node);
break;
case Token.OR:
@ -2981,7 +2975,7 @@ Else pass the JS object in the aReg and 0.0 in the dReg.
cfw.markLabel(startLabel, (short)1);
while (child != null) {
generateStatement(child, node);
generateStatement(child);
child = child.getNext();
}
@ -3043,9 +3037,9 @@ Else pass the JS object in the aReg and 0.0 in the dReg.
cfw.markLabel(realEnd);
}
private final int JAVASCRIPT_EXCEPTION = 0;
private final int EVALUATOR_EXCEPTION = 1;
private final int ECMAERROR_EXCEPTION = 2;
private static final int JAVASCRIPT_EXCEPTION = 0;
private static final int EVALUATOR_EXCEPTION = 1;
private static final int ECMAERROR_EXCEPTION = 2;
private void generateCatchBlock(int exceptionType,
short savedVariableObject,
@ -3149,7 +3143,7 @@ Else pass the JS object in the aReg and 0.0 in the dReg.
+")Ljava/lang/String;");
}
private void visitIncDec(Node node, boolean isInc)
private void visitIncDec(Node node)
{
int incrDecrMask = node.getExistingIntProp(Node.INCRDECR_PROP);
Node child = node.getFirstChild();
@ -3999,14 +3993,6 @@ Else pass the JS object in the aReg and 0.0 in the dReg.
"(out of locals)");
}
private void releaseWordpairLocal(short local)
{
if (local < firstFreeLocal)
firstFreeLocal = local;
locals[local] = false;
locals[local + 1] = false;
}
private void releaseWordLocal(short local)
{
if (local < firstFreeLocal)

View File

@ -48,9 +48,8 @@ class Optimizer
// It is assumed that (NumberType | AnyType) == AnyType
void optimize(ScriptOrFnNode scriptOrFn, int optLevel)
void optimize(ScriptOrFnNode scriptOrFn)
{
itsOptLevel = optLevel;
// run on one function at a time for now
int functionCount = scriptOrFn.getFunctionCount();
for (int i = 0; i != functionCount; ++i) {
@ -502,7 +501,6 @@ class Optimizer
}
}
private int itsOptLevel;
private boolean inDirectCallFunction;
OptFunctionNode theFunction;
private boolean parameterUsedInNumberContext;

View File

@ -988,7 +988,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
{
if (xmlValue instanceof XMLList)
{
xml = (XML)((XMLList) xmlValue).item(i);
xml = ((XMLList) xmlValue).item(i);
}
else
{
@ -1052,7 +1052,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
throw ScriptRuntime.typeError(e.getMessage());
}
result = createTextElement(lib, qname, value.toString());
result = createTextElement(lib, qname, value);
return result;
}
@ -1306,7 +1306,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
{
for (int i = 0; i < xmlValue.length(); i++)
{
XML xml = (XML)((XMLList) xmlValue).item(i);
XML xml = ((XMLList) xmlValue).item(i);
if (xml.tokenType() == XmlCursor.TokenType.ATTR)
{
@ -1320,7 +1320,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
xmlValue = makeXmlFromString(lib, xmlName, ScriptRuntime.toString(value));
}
XMLList matches = (XMLList)getPropertyList(xmlName);
XMLList matches = getPropertyList(xmlName);
if (matches.length() == 0)
{
@ -1335,7 +1335,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
}
// Replace first match with new value.
doPut(xmlName, (XML)matches.item(0), xmlValue);
doPut(xmlName, matches.item(0), xmlValue);
}
}
}
@ -1389,7 +1389,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
}
else
{
XMLList matches = (XMLList)getPropertyList(name);
XMLList matches = getPropertyList(name);
matches.remove();
}
@ -2715,11 +2715,11 @@ todo need to handle namespace prefix not found in XML look for namespace type in
XML replace(long index, Object xml)
{
XMLList xlChildToReplace = (XMLList)child(index);
XMLList xlChildToReplace = child(index);
if (xlChildToReplace.length() > 0)
{
// One exists an that index
XML childToReplace = (XML)xlChildToReplace.item(0);
XML childToReplace = xlChildToReplace.item(0);
insertChildAfter(childToReplace, xml);
removeChild(index);
}
@ -2746,7 +2746,7 @@ todo need to handle namespace prefix not found in XML look for namespace type in
{
// remove all children
XMLName xmlName = XMLName.formStar();
XMLList matches = (XMLList)getPropertyList(xmlName);
XMLList matches = getPropertyList(xmlName);
matches.remove();
// append new children

View File

@ -68,7 +68,7 @@ class XMLCtor extends IdFunctionObject
int id = super.getMaxInstanceId() + i;
String name = getInstanceIdName(id);
Object value = ScriptableObject.getProperty(source, name);
if (value == ScriptableObject.NOT_FOUND) {
if (value == Scriptable.NOT_FOUND) {
continue;
}
switch (i) {
@ -250,7 +250,6 @@ class XMLCtor extends IdFunctionObject
return obj;
}
case Id_setSettings: {
Scriptable obj = null;
if (args.length == 0
|| args[0] == null
|| args[0] == Undefined.instance)

View File

@ -490,7 +490,7 @@ public final class XMLLibImpl extends XMLLib implements Serializable
listToAdd = new XMLList(this, obj1);
}
} else {
listToAdd.addToList(((XML)obj1));
listToAdd.addToList(obj1);
}
if (obj2 instanceof XMLList) {
@ -499,7 +499,7 @@ public final class XMLLibImpl extends XMLLib implements Serializable
listToAdd.addToList(list2.item(i));
}
} else if (obj2 instanceof XML) {
listToAdd.addToList(((XML)obj2));
listToAdd.addToList(obj2);
}
return listToAdd;

View File

@ -156,7 +156,7 @@ class XMLList extends XMLObjectImpl implements Function
XML orgXML = XML.createFromJS(lib, frag);
// Now orphan the children and add them to our XMLList.
XMLList children = (XMLList)orgXML.children();
XMLList children = orgXML.children();
_annos = new AnnotationList();
@ -391,11 +391,11 @@ class XMLList extends XMLObjectImpl implements Function
}
else
{
XML xml = (XML)item(0);
XML xml = item(0);
xml.putXMLProperty(xmlName, value);
// Update the list with the new item at location 0.
replace(0, (XML)item(0));
replace(0, item(0));
}
// Now add us to our parent
@ -413,11 +413,11 @@ class XMLList extends XMLObjectImpl implements Function
}
else
{
XML xml = (XML)item(0);
XML xml = item(0);
xml.putXMLProperty(xmlName, value);
// Update the list with the new item at location 0.
replace(0, (XML)item(0));
replace(0, item(0));
}
}
@ -502,14 +502,14 @@ class XMLList extends XMLObjectImpl implements Function
if (list.length() > 0)
{
int lastIndexAdded = xmlNode.childIndex();
xmlNode.replaceAll((XML)list.item(0));
replace(index, (XML)list.item(0));
xmlNode.replaceAll(list.item(0));
replace(index, list.item(0));
for (int i = 1; i < list.length(); i++)
{
xmlParent.insertChildAfter(xmlParent.getXmlChild(lastIndexAdded), list.item(i));
lastIndexAdded++;
insert(index + i, (XML)list.item(i));
insert(index + i, list.item(i));
}
}
}
@ -540,12 +540,12 @@ class XMLList extends XMLObjectImpl implements Function
if (list.length() > 0)
{
xmlNode.replaceAll((XML)list.item(0));
replace(index, (XML)list.item(0));
xmlNode.replaceAll(list.item(0));
replace(index, list.item(0));
for (int i = 1; i < list.length(); i++)
{
insert(index + i, (XML)list.item(i));
insert(index + i, list.item(i));
}
}
}
@ -686,7 +686,7 @@ class XMLList extends XMLObjectImpl implements Function
XMLList xmlSrc = (XMLList)toAdd;
for (int i = 0; i < xmlSrc.length(); i++)
{
_annos.add(((XML)xmlSrc.item(i)).getAnnotation());
_annos.add((xmlSrc.item(i)).getAnnotation());
}
}
else if (toAdd instanceof XML)
@ -1261,7 +1261,7 @@ class XMLList extends XMLObjectImpl implements Function
} else if (name instanceof Number) {
double x = ((Number)name).doubleValue();
index = (long)x;
if ((double)index != x) {
if (index != x) {
return false;
}
if (index == 0 && 1.0 / x < 0) {

View File

@ -43,6 +43,8 @@ import org.mozilla.javascript.xml.*;
final class XMLWithScope extends NativeWith
{
private static final long serialVersionUID = -696429282095170887L;
private XMLLibImpl lib;
private int _currIndex;
private XMLList _xmlList;
@ -84,7 +86,6 @@ final class XMLWithScope extends NativeWith
XMLObject seed = _dqPrototype;
XMLList xmlL = _xmlList;
Object result;
if (seed instanceof XMLList) {
// We're a list so keep testing each element of the list if the
// result on the top of stack is true then that element is added