File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 49
49
import com .oracle .truffle .api .instrumentation .Tag ;
50
50
import com .oracle .truffle .api .nodes .NodeCost ;
51
51
import com .oracle .truffle .api .nodes .UnexpectedResultException ;
52
+ import com .oracle .truffle .api .source .SourceSection ;
52
53
53
54
/**
54
55
* Base class for all expressions. Expressions always return a value.
@@ -141,7 +142,11 @@ public static final class ExpressionWithSideEffects extends ExpressionNode {
141
142
private ExpressionWithSideEffects (ExpressionNode node , StatementNode sideEffect ) {
142
143
this .node = node ;
143
144
this .sideEffect = sideEffect ;
144
- this .assignSourceSection (node .getSourceSection ());
145
+ SourceSection sourceSection = node .getSourceSection ();
146
+ if (sourceSection == null ) {
147
+ sourceSection = sideEffect .getSourceSection ();
148
+ }
149
+ this .assignSourceSection (sourceSection );
145
150
}
146
151
147
152
@ Override
Original file line number Diff line number Diff line change @@ -227,6 +227,7 @@ private SourceSection deriveSourceSection(RuleNode node) {
227
227
public Object visitFile_input (Python3Parser .File_inputContext ctx ) {
228
228
environment .enterScope (ctx .scope );
229
229
ExpressionNode file = asExpression (super .visitFile_input (ctx ));
230
+ deriveSourceSection (ctx , file );
230
231
environment .leaveScope ();
231
232
return factory .createModuleRoot (name , file , ctx .scope .getFrameDescriptor ());
232
233
}
@@ -247,6 +248,7 @@ public Object visitEval_input(Python3Parser.Eval_inputContext ctx) {
247
248
public Object visitSingle_input (Python3Parser .Single_inputContext ctx ) {
248
249
environment .enterScope (ctx .scope );
249
250
ExpressionNode body = asExpression (super .visitSingle_input (ctx ));
251
+ deriveSourceSection (ctx , body );
250
252
environment .leaveScope ();
251
253
if (isInlineMode ) {
252
254
return body ;
You can’t perform that action at this time.
0 commit comments