|
45 | 45 | import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode; |
46 | 46 | import com.oracle.graal.python.runtime.exception.PException; |
47 | 47 | import com.oracle.graal.python.runtime.sequence.PSequence; |
48 | | -import com.oracle.graal.python.runtime.sequence.SequenceUtil.NormalizeIndexNode; |
49 | 48 | import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage; |
50 | 49 | import com.oracle.truffle.api.dsl.Cached; |
51 | 50 | import com.oracle.truffle.api.dsl.GenerateNodeFactory; |
@@ -140,15 +139,13 @@ public Object next(PBaseSetIterator self) { |
140 | 139 |
|
141 | 140 | @Specialization(guards = "self.isPList()") |
142 | 141 | public Object nextList(PSequenceIterator self, |
143 | | - @Cached("createClassProfile()") ValueProfile storageProfile, |
144 | | - @Cached("create()") NormalizeIndexNode normalize) { |
| 142 | + @Cached("createClassProfile()") ValueProfile storageProfile) { |
145 | 143 | SequenceStorage storage = storageProfile.profile(((PList) self.getPSequence()).getSequenceStorage()); |
146 | 144 | int length = storage.length(); |
147 | | - if (!self.stopIterationReached && self.index < length) { |
148 | | - int index = normalize.execute(self.index++, length, "list index out of range"); |
149 | | - return storage.getItemNormalized(index); |
| 145 | + if (!self.isExhausted() && self.index < length) { |
| 146 | + return storage.getItemNormalized(self.index++); |
150 | 147 | } |
151 | | - self.stopIterationReached = true; |
| 148 | + self.setExhausted(); |
152 | 149 | throw raise(StopIteration); |
153 | 150 | } |
154 | 151 |
|
|
0 commit comments