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.
This commit is contained in:
igor%mir2.org 2003-02-14 23:56:34 +00:00
Родитель 41b3e5345d
Коммит c0bc03b5bf
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -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;
}