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 1
1
/*
2
- * Copyright (c) 2017, 2018 , Oracle and/or its affiliates.
2
+ * Copyright (c) 2017, 2019 , Oracle and/or its affiliates.
3
3
* Copyright (c) 2013, Regents of the University of California
4
4
*
5
5
* All rights reserved.
33
33
import com .oracle .graal .python .builtins .objects .object .PythonObject ;
34
34
import com .oracle .graal .python .builtins .objects .type .LazyPythonClass ;
35
35
import com .oracle .graal .python .nodes .SpecialMethodNames ;
36
+ import com .oracle .graal .python .nodes .generator .GeneratorFunctionRootNode ;
36
37
import com .oracle .truffle .api .CompilerAsserts ;
37
38
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
38
39
import com .oracle .truffle .api .RootCallTarget ;
@@ -144,7 +145,11 @@ public void setDefaults(Object[] defaults) {
144
145
145
146
@ TruffleBoundary
146
147
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 ();
148
153
if (sourceSection != null ) {
149
154
return sourceSection .getCharacters ().toString ();
150
155
}
You can’t perform that action at this time.
0 commit comments