File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
33 * Copyright (c) 2013, Regents of the University of California
44 *
55 * All rights reserved.
3333import com .oracle .graal .python .builtins .objects .object .PythonObject ;
3434import com .oracle .graal .python .builtins .objects .type .LazyPythonClass ;
3535import com .oracle .graal .python .nodes .SpecialMethodNames ;
36+ import com .oracle .graal .python .nodes .generator .GeneratorFunctionRootNode ;
3637import com .oracle .truffle .api .CompilerAsserts ;
3738import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
3839import com .oracle .truffle .api .RootCallTarget ;
@@ -144,7 +145,11 @@ public void setDefaults(Object[] defaults) {
144145
145146 @ TruffleBoundary
146147 public String getSourceCode () {
147- SourceSection sourceSection = callTarget .getRootNode ().getSourceSection ();
148+ RootNode rootNode = callTarget .getRootNode ();
149+ if (rootNode instanceof GeneratorFunctionRootNode ) {
150+ rootNode = ((GeneratorFunctionRootNode ) rootNode ).getFunctionRootNode ();
151+ }
152+ SourceSection sourceSection = rootNode .getSourceSection ();
148153 if (sourceSection != null ) {
149154 return sourceSection .getCharacters ().toString ();
150155 }
You can’t perform that action at this time.
0 commit comments