diff options
Diffstat (limited to 'src/jdk/nashorn/internal/ir/BaseNode.java')
-rw-r--r-- | src/jdk/nashorn/internal/ir/BaseNode.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/jdk/nashorn/internal/ir/BaseNode.java b/src/jdk/nashorn/internal/ir/BaseNode.java index 35479a7a..4e59753a 100644 --- a/src/jdk/nashorn/internal/ir/BaseNode.java +++ b/src/jdk/nashorn/internal/ir/BaseNode.java @@ -27,9 +27,9 @@ package jdk.nashorn.internal.ir; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; -import java.util.function.Function; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.annotations.Immutable; +import jdk.nashorn.internal.parser.TokenType; /** * IR base for accessing/indexing nodes. @@ -98,7 +98,7 @@ public abstract class BaseNode extends Expression implements FunctionCall, Optim } @Override - public Type getType(final Function<Symbol, Type> localVariableTypes) { + public Type getType() { return type == null ? getMostPessimisticType() : type; } @@ -123,6 +123,14 @@ public abstract class BaseNode extends Expression implements FunctionCall, Optim } /** + * Return true if this node represents an index operation normally represented as {@link IndexNode}. + * @return true if an index access. + */ + public boolean isIndex() { + return isTokenType(TokenType.LBRACKET); + } + + /** * Mark this node as being the callee operand of a {@link CallNode}. * @return a base node identical to this one in all aspects except with its function flag set. */ |