|
31 | 31 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__DICT__;
|
32 | 32 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__FUNC__;
|
33 | 33 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__KWDEFAULTS__;
|
34 |
| -import static com.oracle.graal.python.nodes.SpecialMethodNames.__GETATTR__; |
| 34 | +import static com.oracle.graal.python.nodes.SpecialMethodNames.__GETATTRIBUTE__; |
35 | 35 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__GET__;
|
36 | 36 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REDUCE__;
|
37 | 37 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
|
|
57 | 57 | import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
|
58 | 58 | import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
|
59 | 59 | import com.oracle.graal.python.nodes.object.GetLazyClassNode;
|
| 60 | +import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile; |
| 61 | +import com.oracle.graal.python.runtime.exception.PException; |
60 | 62 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
61 | 63 | import com.oracle.truffle.api.dsl.Cached;
|
62 | 64 | import com.oracle.truffle.api.dsl.GenerateNodeFactory;
|
@@ -106,13 +108,19 @@ protected Object doIt(VirtualFrame frame, PMethod self,
|
106 | 108 | }
|
107 | 109 | }
|
108 | 110 |
|
109 |
| - @Builtin(name = __GETATTR__, minNumOfPositionalArgs = 2) |
| 111 | + @Builtin(name = __GETATTRIBUTE__, minNumOfPositionalArgs = 2) |
110 | 112 | @GenerateNodeFactory
|
111 |
| - public abstract static class GetattrNode extends PythonBuiltinNode { |
| 113 | + public abstract static class GetattributeNode extends PythonBuiltinNode { |
112 | 114 | @Specialization
|
113 | 115 | protected Object doIt(VirtualFrame frame, PMethod self, Object key,
|
114 |
| - @Cached("create()") ObjectBuiltins.GetAttributeNode objectGetattrNode) { |
115 |
| - return objectGetattrNode.execute(frame, self.getFunction(), key); |
| 116 | + @Cached("create()") ObjectBuiltins.GetAttributeNode objectGetattrNode, |
| 117 | + @Cached("create()") IsBuiltinClassProfile errorProfile) { |
| 118 | + try { |
| 119 | + return objectGetattrNode.execute(frame, self, key); |
| 120 | + } catch (PException e) { |
| 121 | + e.expectAttributeError(errorProfile); |
| 122 | + return objectGetattrNode.execute(frame, self.getFunction(), key); |
| 123 | + } |
116 | 124 | }
|
117 | 125 | }
|
118 | 126 |
|
|
0 commit comments