|
45 | 45 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__MUL__;
|
46 | 46 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__NE__;
|
47 | 47 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
|
| 48 | +import static com.oracle.graal.python.nodes.SpecialMethodNames.__REVERSED__; |
48 | 49 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__RMUL__;
|
49 | 50 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__SETITEM__;
|
50 | 51 | import static com.oracle.graal.python.runtime.exception.PythonErrorType.MemoryError;
|
@@ -1005,7 +1006,6 @@ boolean doPList(VirtualFrame frame, PList left, PList right,
|
1005 | 1006 | /**
|
1006 | 1007 | * This is a fix for the bpo-38588 bug. See
|
1007 | 1008 | * {@code test_list.py: ListTest.test_equal_operator_modifying_operand}
|
1008 |
| - * |
1009 | 1009 | */
|
1010 | 1010 | @Specialization(guards = "isObjectStorage(left, right)")
|
1011 | 1011 | boolean doPListObjectStorage(VirtualFrame frame, PList left, PList right,
|
@@ -1161,4 +1161,16 @@ static Object doGeneric(@SuppressWarnings("unused") Object self) {
|
1161 | 1161 | return PNone.NONE;
|
1162 | 1162 | }
|
1163 | 1163 | }
|
| 1164 | + |
| 1165 | + @Builtin(name = __REVERSED__, minNumOfPositionalArgs = 1) |
| 1166 | + @GenerateNodeFactory |
| 1167 | + abstract static class ReverseNode extends PythonUnaryBuiltinNode { |
| 1168 | + @Specialization |
| 1169 | + Object reverse(PList self, |
| 1170 | + @Cached SequenceNodes.GetSequenceStorageNode getSequenceStorageNode, |
| 1171 | + @Cached SequenceStorageNodes.LenNode lenNode) { |
| 1172 | + int len = lenNode.execute(getSequenceStorageNode.execute(self)); |
| 1173 | + return factory().createSequenceReverseIterator(PythonBuiltinClassType.PReverseIterator, self, len); |
| 1174 | + } |
| 1175 | + } |
1164 | 1176 | }
|
0 commit comments