1.1 --- a/src/jdk/nashorn/internal/ir/IndexNode.java Tue May 07 14:43:17 2013 +0200 1.2 +++ b/src/jdk/nashorn/internal/ir/IndexNode.java Wed May 08 15:51:36 2013 +0200 1.3 @@ -106,6 +106,18 @@ 1.4 return index; 1.5 } 1.6 1.7 + /** 1.8 + * Set the index expression for this node 1.9 + * @param index new index expression 1.10 + * @return a node equivalent to this one except for the requested change. 1.11 + */ 1.12 + public IndexNode setIndex(Node index) { 1.13 + if(this.index == index) { 1.14 + return this; 1.15 + } 1.16 + return new IndexNode(this, base, index, isFunction(), hasCallSiteType()); 1.17 + } 1.18 + 1.19 @Override 1.20 public BaseNode setIsFunction() { 1.21 if (isFunction()) { 1.22 @@ -115,10 +127,10 @@ 1.23 } 1.24 1.25 @Override 1.26 - public IndexNode setType(final Type type) { 1.27 + public IndexNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) { 1.28 logTypeChange(type); 1.29 - getSymbol().setTypeOverride(type); //always a temp so this is fine. 1.30 - return new IndexNode(this, base, index, isFunction(), true); 1.31 + final IndexNode newIndexNode = (IndexNode)setSymbol(lc, getSymbol().setTypeOverrideShared(type, ts)); 1.32 + return new IndexNode(newIndexNode, base, index, isFunction(), true); 1.33 } 1.34 1.35 }