src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java

Print this page

        

*** 26,35 **** --- 26,37 ---- package jdk.nashorn.internal.ir; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.annotations.Immutable; import jdk.nashorn.internal.ir.visitor.NodeVisitor; + import jdk.nashorn.internal.parser.Token; + import jdk.nashorn.internal.parser.TokenType; /** * IR representation of a property access (period operator.) */ @Immutable
*** 99,108 **** --- 101,118 ---- */ public String getProperty() { return property; } + /** + * Return true if this node represents an index operation normally represented as {@link IndexNode}. + * @return true if an index access. + */ + public boolean isIndex() { + return Token.descType(getToken()) == TokenType.LBRACKET; + } + private AccessNode setBase(final Expression base) { if (this.base == base) { return this; } return new AccessNode(this, base, property, isFunction(), type, programPoint);