提交 2ba00b9a 编写于 作者: A attila

8015673: Type for :e symbol is wrong

Reviewed-by: jlaskey, lagergren
上级 dae98f66
...@@ -84,13 +84,12 @@ import jdk.nashorn.internal.ir.TryNode; ...@@ -84,13 +84,12 @@ import jdk.nashorn.internal.ir.TryNode;
import jdk.nashorn.internal.ir.UnaryNode; import jdk.nashorn.internal.ir.UnaryNode;
import jdk.nashorn.internal.ir.VarNode; import jdk.nashorn.internal.ir.VarNode;
import jdk.nashorn.internal.ir.WithNode; import jdk.nashorn.internal.ir.WithNode;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor; import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.parser.TokenType; import jdk.nashorn.internal.parser.TokenType;
import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.Debug; import jdk.nashorn.internal.runtime.Debug;
import jdk.nashorn.internal.runtime.DebugLogger; import jdk.nashorn.internal.runtime.DebugLogger;
import jdk.nashorn.internal.runtime.ECMAException;
import jdk.nashorn.internal.runtime.JSType; import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.Property; import jdk.nashorn.internal.runtime.Property;
import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.PropertyMap;
...@@ -1323,7 +1322,7 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> { ...@@ -1323,7 +1322,7 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> {
@Override @Override
public Node leaveForNode(final ForNode forNode) { public Node leaveForNode(final ForNode forNode) {
if (forNode.isForIn()) { if (forNode.isForIn()) {
forNode.setIterator(newInternal(lc.getCurrentFunction().uniqueName(ITERATOR_PREFIX.symbolName()), Type.OBJECT)); //NASHORN-73 forNode.setIterator(newInternal(lc.getCurrentFunction().uniqueName(ITERATOR_PREFIX.symbolName()), Type.typeFor(ITERATOR_PREFIX.type()))); //NASHORN-73
/* /*
* Iterators return objects, so we need to widen the scope of the * Iterators return objects, so we need to widen the scope of the
* init variable if it, for example, has been assigned double type * init variable if it, for example, has been assigned double type
...@@ -1500,7 +1499,7 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> { ...@@ -1500,7 +1499,7 @@ final class Attr extends NodeOperatorVisitor<LexicalContext> {
} }
private Symbol exceptionSymbol() { private Symbol exceptionSymbol() {
return newInternal(lc.getCurrentFunction().uniqueName(EXCEPTION_PREFIX.symbolName()), Type.typeFor(ECMAException.class)); return newInternal(lc.getCurrentFunction().uniqueName(EXCEPTION_PREFIX.symbolName()), Type.typeFor(EXCEPTION_PREFIX.type()));
} }
/** /**
......
...@@ -29,6 +29,7 @@ import static jdk.nashorn.internal.lookup.Lookup.MH; ...@@ -29,6 +29,7 @@ import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.util.Iterator;
import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.runtime.ScriptFunction; import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptObject;
...@@ -105,13 +106,13 @@ public enum CompilerConstants { ...@@ -105,13 +106,13 @@ public enum CompilerConstants {
ARGUMENTS("arguments", Object.class, 2), ARGUMENTS("arguments", Object.class, 2),
/** prefix for iterators for for (x in ...) */ /** prefix for iterators for for (x in ...) */
ITERATOR_PREFIX(":i"), ITERATOR_PREFIX(":i", Iterator.class),
/** prefix for tag variable used for switch evaluation */ /** prefix for tag variable used for switch evaluation */
SWITCH_TAG_PREFIX(":s"), SWITCH_TAG_PREFIX(":s"),
/** prefix for all exceptions */ /** prefix for all exceptions */
EXCEPTION_PREFIX(":e"), EXCEPTION_PREFIX(":e", Throwable.class),
/** prefix for quick slots generated in Store */ /** prefix for quick slots generated in Store */
QUICK_PREFIX(":q"), QUICK_PREFIX(":q"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册