|
201 | 201 | import com.oracle.graal.python.nodes.attributes.SetAttributeNode;
|
202 | 202 | import com.oracle.graal.python.nodes.builtins.ListNodes;
|
203 | 203 | import com.oracle.graal.python.nodes.builtins.ListNodes.ConstructListNode;
|
| 204 | +import com.oracle.graal.python.nodes.bytecode.GetAIterNode; |
| 205 | +import com.oracle.graal.python.nodes.bytecode.GetANextNode; |
204 | 206 | import com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode;
|
205 | 207 | import com.oracle.graal.python.nodes.call.CallDispatchNode;
|
206 | 208 | import com.oracle.graal.python.nodes.call.CallNode;
|
|
210 | 212 | import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
|
211 | 213 | import com.oracle.graal.python.nodes.call.special.LookupAndCallTernaryNode;
|
212 | 214 | import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode;
|
| 215 | +import com.oracle.graal.python.nodes.call.special.LookupSpecialMethodSlotNode; |
213 | 216 | import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
|
214 | 217 | import com.oracle.graal.python.nodes.expression.BinaryArithmetic;
|
215 | 218 | import com.oracle.graal.python.nodes.expression.BinaryArithmetic.AddNode;
|
@@ -2584,4 +2587,35 @@ class InitializeBuildClass {
|
2584 | 2587 | return cls;
|
2585 | 2588 | }
|
2586 | 2589 | }
|
| 2590 | + |
| 2591 | + @Builtin(name = "anext", minNumOfPositionalArgs = 1) |
| 2592 | + @GenerateNodeFactory |
| 2593 | + public static abstract class ANext extends PythonUnaryBuiltinNode { |
| 2594 | + @Specialization |
| 2595 | + public Object doGeneric(VirtualFrame frame, Object asyncIter, |
| 2596 | + @Bind("this") Node inliningTarget, |
| 2597 | + @Cached(parameters = "ANext") LookupSpecialMethodSlotNode getANext, |
| 2598 | + @Cached InlinedGetClassNode getAsyncIterType, |
| 2599 | + @Cached PRaiseNode raiseNoANext, |
| 2600 | + @Cached CallUnaryMethodNode callANext, |
| 2601 | + @Cached TypeNodes.GetNameNode getName) { |
| 2602 | + // TODO: two argument anext |
| 2603 | + Object type = getAsyncIterType.execute(inliningTarget, asyncIter); |
| 2604 | + Object getter = getANext.execute(frame, type, asyncIter); |
| 2605 | + if (getter == NO_VALUE) { |
| 2606 | + throw raiseNoANext.raise(PythonBuiltinClassType.TypeError, ErrorMessages.OBJECT_NOT_ASYNCGEN, getName.execute(type)); |
| 2607 | + } |
| 2608 | + return callANext.executeObject(frame, getter, asyncIter); |
| 2609 | + } |
| 2610 | + } |
| 2611 | + |
| 2612 | + @Builtin(name = "aiter", minNumOfPositionalArgs = 1) |
| 2613 | + @GenerateNodeFactory |
| 2614 | + public static abstract class AIter extends PythonUnaryBuiltinNode { |
| 2615 | + @Specialization |
| 2616 | + public Object doGeneric(VirtualFrame frame, Object arg, |
| 2617 | + @Cached GetAIterNode aiter) { |
| 2618 | + return aiter.execute(frame, arg); |
| 2619 | + } |
| 2620 | + } |
2587 | 2621 | }
|
0 commit comments