The reason for the bug was that omj/optimizer/Optimizer.java when optimizing code for this[name] (see GETELEM switch, line 665) assumed a number context for GETELEM index node unconditionally which is wrong.

The fix uses number context only if [] argument is known for sure to be a number.


git-svn-id: svn://10.0.0.236/trunk@137832 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org
2003-02-14 23:56:34 +00:00
parent ff97fb4bbc
commit 34304f5463

View File

@@ -676,11 +676,12 @@ public class Optimizer {
}
int indexType = rewriteForNumberVariables(arrayIndex);
if (indexType == TypeEvent.NumberType) {
// setting the ISNUMBER_PROP signals the codegen
// to use the scriptRuntime.getElem that takes
// a double index
n.putIntProp(Node.ISNUMBER_PROP, Node.RIGHT);
markDCPNumberContext(arrayIndex);
if (!convertParameter(arrayIndex)) {
// setting the ISNUMBER_PROP signals the codegen
// to use the scriptRuntime.getElem that takes
// a double index
n.putIntProp(Node.ISNUMBER_PROP, Node.RIGHT);
}
}
return TypeEvent.NoType;
}