|
28 | 28 |
|
29 | 29 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__CODE__;
|
30 | 30 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__DEFAULTS__;
|
| 31 | +import static com.oracle.graal.python.nodes.SpecialAttributeNames.__DICT__; |
31 | 32 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__FUNC__;
|
32 | 33 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__KWDEFAULTS__;
|
| 34 | +import static com.oracle.graal.python.nodes.SpecialMethodNames.__GETATTR__; |
33 | 35 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__GET__;
|
34 | 36 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REDUCE__;
|
35 | 37 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
|
|
43 | 45 | import com.oracle.graal.python.builtins.PythonBuiltins;
|
44 | 46 | import com.oracle.graal.python.builtins.objects.PNone;
|
45 | 47 | import com.oracle.graal.python.builtins.objects.function.PKeyword;
|
| 48 | +import com.oracle.graal.python.builtins.objects.object.ObjectBuiltins; |
46 | 49 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetNameNode;
|
47 | 50 | import com.oracle.graal.python.nodes.SpecialAttributeNames;
|
48 | 51 | import com.oracle.graal.python.nodes.attributes.GetAttributeNode;
|
@@ -93,6 +96,26 @@ protected Object doIt(VirtualFrame frame, PMethod self,
|
93 | 96 | }
|
94 | 97 | }
|
95 | 98 |
|
| 99 | + @Builtin(name = __DICT__, minNumOfPositionalArgs = 1, isGetter = true) |
| 100 | + @GenerateNodeFactory |
| 101 | + public abstract static class DictNode extends PythonBuiltinNode { |
| 102 | + @Specialization |
| 103 | + protected Object doIt(VirtualFrame frame, PMethod self, |
| 104 | + @Cached("create(__GETATTRIBUTE__)") LookupAndCallBinaryNode getDict) { |
| 105 | + return getDict.executeObject(frame, self.getFunction(), __DICT__); |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + @Builtin(name = __GETATTR__, minNumOfPositionalArgs = 2) |
| 110 | + @GenerateNodeFactory |
| 111 | + public abstract static class GetattrNode extends PythonBuiltinNode { |
| 112 | + @Specialization |
| 113 | + protected Object doIt(VirtualFrame frame, PMethod self, Object key, |
| 114 | + @Cached("create()") ObjectBuiltins.GetAttributeNode objectGetattrNode) { |
| 115 | + return objectGetattrNode.execute(frame, self.getFunction(), key); |
| 116 | + } |
| 117 | + } |
| 118 | + |
96 | 119 | @Builtin(name = __REPR__, minNumOfPositionalArgs = 1)
|
97 | 120 | @GenerateNodeFactory
|
98 | 121 | public abstract static class ReprNode extends PythonUnaryBuiltinNode {
|
|
0 commit comments