|
39 | 39 | import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction; |
40 | 40 | import com.oracle.graal.python.builtins.objects.function.PKeyword; |
41 | 41 | import com.oracle.graal.python.builtins.objects.method.PBuiltinMethod; |
| 42 | +import com.oracle.graal.python.builtins.objects.function.PythonCallable; |
42 | 43 | import com.oracle.graal.python.builtins.objects.module.PythonModule; |
43 | 44 | import com.oracle.graal.python.builtins.objects.object.PythonObject; |
| 45 | +import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass; |
44 | 46 | import com.oracle.graal.python.nodes.BuiltinNames; |
45 | 47 | import com.oracle.graal.python.nodes.NodeFactory; |
46 | 48 | import com.oracle.graal.python.nodes.PNode; |
|
75 | 77 | import com.oracle.truffle.api.nodes.RootNode; |
76 | 78 | import com.oracle.truffle.api.source.Source; |
77 | 79 | import com.oracle.truffle.api.source.Source.Builder; |
| 80 | +import com.oracle.truffle.api.source.SourceSection; |
78 | 81 |
|
79 | 82 | @TruffleLanguage.Registration(id = PythonLanguage.ID, name = PythonLanguage.NAME, version = PythonLanguage.VERSION, mimeType = PythonLanguage.MIME_TYPE, interactive = true, internal = false, contextPolicy = TruffleLanguage.ContextPolicy.REUSE) |
80 | 83 | @ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.TryBlockTag.class, DebuggerTags.AlwaysHalt.class}) |
@@ -350,6 +353,17 @@ protected Iterable<Scope> findTopScopes(PythonContext context) { |
350 | 353 | return scopes; |
351 | 354 | } |
352 | 355 |
|
| 356 | + @Override |
| 357 | + protected SourceSection findSourceLocation(PythonContext context, Object value) { |
| 358 | + if (value instanceof PythonCallable) { |
| 359 | + PythonCallable callable = (PythonCallable) value; |
| 360 | + if (!(value instanceof PythonBuiltinClass)) { |
| 361 | + return callable.getCallTarget().getRootNode().getSourceSection(); |
| 362 | + } |
| 363 | + } |
| 364 | + return null; |
| 365 | + } |
| 366 | + |
353 | 367 | @Override |
354 | 368 | protected String toString(PythonContext context, Object value) { |
355 | 369 | final PythonModule builtins = context.getBuiltins(); |
|
0 commit comments