|
41 | 41 | import com.oracle.graal.python.builtins.objects.common.HashingStorage;
|
42 | 42 | import com.oracle.graal.python.builtins.objects.function.PArguments;
|
43 | 43 | import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
|
| 44 | +import com.oracle.graal.python.builtins.objects.function.PFunction; |
44 | 45 | import com.oracle.graal.python.builtins.objects.function.PKeyword;
|
| 46 | +import com.oracle.graal.python.builtins.objects.function.PythonCallable; |
45 | 47 | import com.oracle.graal.python.builtins.objects.method.PBuiltinMethod;
|
| 48 | +import com.oracle.graal.python.builtins.objects.method.PMethod; |
46 | 49 | import com.oracle.graal.python.builtins.objects.module.PythonModule;
|
47 | 50 | import com.oracle.graal.python.builtins.objects.object.PythonObject;
|
| 51 | +import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass; |
48 | 52 | import com.oracle.graal.python.nodes.BuiltinNames;
|
49 | 53 | import com.oracle.graal.python.nodes.NodeFactory;
|
50 | 54 | import com.oracle.graal.python.nodes.PNode;
|
|
86 | 90 | import com.oracle.truffle.api.object.Shape;
|
87 | 91 | import com.oracle.truffle.api.source.Source;
|
88 | 92 | import com.oracle.truffle.api.source.Source.SourceBuilder;
|
| 93 | +import com.oracle.truffle.api.source.SourceSection; |
89 | 94 |
|
90 |
| -@TruffleLanguage.Registration(id = PythonLanguage.ID, name = PythonLanguage.NAME, version = PythonLanguage.VERSION, mimeType = PythonLanguage.MIME_TYPE, interactive = true, internal = false, contextPolicy = TruffleLanguage.ContextPolicy.SHARED) |
| 95 | +@TruffleLanguage.Registration(id = PythonLanguage.ID, name = PythonLanguage.NAME, version = PythonLanguage.VERSION, characterMimeTypes = PythonLanguage.MIME_TYPE, interactive = true, internal = false, contextPolicy = TruffleLanguage.ContextPolicy.SHARED) |
91 | 96 | @ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.TryBlockTag.class, StandardTags.ExpressionTag.class,
|
92 | 97 | DebuggerTags.AlwaysHalt.class})
|
93 | 98 | public final class PythonLanguage extends TruffleLanguage<PythonContext> {
|
@@ -380,6 +385,15 @@ protected Iterable<Scope> findTopScopes(PythonContext context) {
|
380 | 385 | return scopes;
|
381 | 386 | }
|
382 | 387 |
|
| 388 | + @Override |
| 389 | + protected SourceSection findSourceLocation(PythonContext context, Object value) { |
| 390 | + if (value instanceof PFunction || value instanceof PMethod) { |
| 391 | + PythonCallable callable = (PythonCallable) value; |
| 392 | + return callable.getCallTarget().getRootNode().getSourceSection(); |
| 393 | + } |
| 394 | + return null; |
| 395 | + } |
| 396 | + |
383 | 397 | @Override
|
384 | 398 | protected String toString(PythonContext context, Object value) {
|
385 | 399 | final PythonModule builtins = context.getBuiltins();
|
|
0 commit comments