@@ -338,7 +338,9 @@ static Object lines(PCode self) {
338
338
private static List <PTuple > computeLinesForBytecodeDSLInterpreter (PBytecodeDSLRootNode root , PythonObjectFactory factory ) {
339
339
BytecodeNode bytecodeNode = root .getBytecodeNode ();
340
340
List <int []> triples = new ArrayList <>();
341
- traverseSourceInformationTree (bytecodeNode .getSourceInformationTree (), triples );
341
+ SourceInformationTree sourceInformationTree = bytecodeNode .getSourceInformationTree ();
342
+ assert sourceInformationTree .getSourceSection () != null ;
343
+ traverseSourceInformationTree (sourceInformationTree , triples );
342
344
return convertTripleBcisToInstructionIndices (bytecodeNode , factory , triples );
343
345
}
344
346
@@ -355,21 +357,21 @@ private static List<PTuple> computeLinesForBytecodeDSLInterpreter(PBytecodeDSLRo
355
357
* assigned the line number of the node.
356
358
*/
357
359
private static void traverseSourceInformationTree (SourceInformationTree tree , List <int []> triples ) {
358
- int startIndex = tree .getStartIndex ();
360
+ int startIndex = tree .getStartBytecodeIndex ();
359
361
int startLine = tree .getSourceSection ().getStartLine ();
360
362
for (SourceInformationTree child : tree .getChildren ()) {
361
- if (startIndex < child .getStartIndex ()) {
363
+ if (startIndex < child .getStartBytecodeIndex ()) {
362
364
// range before child.start is uncovered
363
- triples .add (new int []{startIndex , child .getStartIndex (), startLine });
365
+ triples .add (new int []{startIndex , child .getStartBytecodeIndex (), startLine });
364
366
}
365
367
// recursively handle [child.start, child.end]
366
368
traverseSourceInformationTree (child , triples );
367
- startIndex = child .getEndIndex ();
369
+ startIndex = child .getEndBytecodeIndex ();
368
370
}
369
371
370
- if (startIndex < tree .getEndIndex ()) {
372
+ if (startIndex < tree .getEndBytecodeIndex ()) {
371
373
// range after last_child.end is uncovered
372
- triples .add (new int []{startIndex , tree .getEndIndex (), startLine });
374
+ triples .add (new int []{startIndex , tree .getEndBytecodeIndex (), startLine });
373
375
}
374
376
}
375
377
0 commit comments