@@ -251,7 +251,7 @@ procedure TCompiler.compileForStatement(node: TASTFor);
251251 if node.iterationBlock.direction.nodeType = ntTo then
252252 begin
253253 if compilingFunction then
254- code.addByteCode(oLocalInc, localSymbolIndex)
254+ code.addByteCode(oLocalInc, localSymbolIndex, node.iterationBlock.direction.lineNumber )
255255 else
256256 code.addByteCode(oInc, symbol.symbolName, node.iterationBlock.stepValue)
257257 end
@@ -372,11 +372,9 @@ procedure TCompiler.compileAssignment(node: TASTAssignment);
372372 inAssignment := True;
373373 try
374374 compileCode (node.leftSide);
375- // emit the store method here?
376375 finally
377376 inAssignment := False
378377 end ;
379-
380378 end
381379 else
382380 raise ECompilerException.Create(' Internal Error in compileAssignment' , 0 , 0 )
@@ -486,18 +484,18 @@ procedure TCompiler.compileSubscripts(subscripts: TChildNodes);
486484 begin
487485 // Special case, we only save if its the last index, otherwise we load
488486 if i = subscripts.Count - 1 then
489- code.addByteCode(oSvecIdx, subscripts.Count)
487+ code.addByteCode(oSvecIdx, subscripts.Count, subscripts[i].lineNumber )
490488 else
491- code.addByteCode(oLvecIdx, subscripts.Count);
489+ code.addByteCode(oLvecIdx, subscripts.Count, subscripts.lineNumber );
492490 end
493491 else
494492 begin
495493 if not slicing then
496- code.addByteCode(oLvecIdx, subscripts.Count)
494+ code.addByteCode(oLvecIdx, subscripts.Count, subscripts.lineNumber )
497495 end ;
498496 end ;
499497 if slicing then
500- code.addByteCode(oSliceObj, subscripts.Count);
498+ code.addByteCode(oSliceObj, subscripts.Count, subscripts.lineNumber );
501499
502500 if slicing then
503501 slicingSubscripts.Pop;
@@ -556,10 +554,10 @@ procedure TCompiler.compileList(node: TASTCreatelist);
556554 begin
557555 for i := 0 to node.list.Count - 1 do
558556 compileCode(node.list[i]);
559- code.addByteCode(oCreateList, node.list.Count);
557+ code.addByteCode(oCreateList, node.list.Count, node.lineNumber );
560558 end
561559 else
562- code.addByteCode(oCreateList, 0 ); // empty list
560+ code.addByteCode(oCreateList, 0 , node.lineNumber ); // empty list
563561end ;
564562
565563
@@ -634,15 +632,15 @@ procedure TCompiler.compilePrintStatement(node: TASTNode);
634632 for i := 0 to (node as TASTPrint).argumentList.list.Count - 1 do
635633 compileCode((node as TASTPrint).argumentList.list[i]);
636634
637- code.addByteCode(oPushi, (node as TASTPrint).argumentList.list.Count);
635+ code.addByteCode(oPushi, (node as TASTPrint).argumentList.list.Count, node.lineNumber );
638636 code.addByteCode(oPrint);
639637 end
640638 else
641639 begin
642640 for i := 0 to (node as TASTPrintLn).argumentList.list.Count - 1 do
643641 compileCode((node as TASTPrintLn).argumentList.list[i]);
644642
645- code.addByteCode(oPushi, (node as TASTPrintLn).argumentList.list.Count);
643+ code.addByteCode(oPushi, (node as TASTPrintLn).argumentList.list.Count, node.lineNumber );
646644 code.addByteCode(oPrintln);
647645 end ;
648646end ;
@@ -701,7 +699,7 @@ procedure TCompiler.compileSwitchStatement(node: TASTSwitch);
701699 for i := 0 to listOfCaseStatements.list.Count - 1 do
702700 begin
703701 code.addByteCode(oDup);
704- code.addByteCode(oPushi, caseValues[i]);
702+ code.addByteCode(oPushi, caseValues[i], node.lineNumber );
705703 code.addByteCode(oIsEq);
706704 jumpToLocation[i] := code.addByteCode(oJmpIfTrue);
707705 end ;
@@ -877,7 +875,7 @@ procedure TCompiler.compileRightHandSide (node : TASTIdentifier);
877875 // Check if its in the local space, if yes then emit the local load opecode
878876 // if not it could be in the module space
879877 if currentUserFunction.localSymbolTable.find(node.symbolName, localSymbolIndex) then
880- code.addByteCode(oLoadLocal, localSymbolIndex)
878+ code.addByteCode(oLoadLocal, localSymbolIndex, node.lineNumber )
881879 else
882880 begin
883881 if currentModule.symbolTable.find(node.symbolName, symbol) then
@@ -913,9 +911,9 @@ procedure TCompiler.compileLeftHandSide (node : TASTIdentifier);
913911 if not currentUserFunction.localSymbolTable.find(node.symbolName, localSymbolIndex) then
914912 localSymbolIndex := currentUserFunction.localSymbolTable.addSymbol (node.symbolName);
915913 if inAssignment_NextToEquals then
916- code.addByteCode (oStoreLocal, localSymbolIndex)
914+ code.addByteCode (oStoreLocal, localSymbolIndex, node.lineNumber )
917915 else
918- code.addByteCode (oLoadLocal, localSymbolIndex)
916+ code.addByteCode (oLoadLocal, localSymbolIndex, node.lineNumber )
919917 end
920918 end
921919 else
@@ -980,7 +978,7 @@ procedure TCompiler.compilePrimaryFunction (node : TASTPrimaryFunction);
980978 for anode in node.argumentList.list do
981979 compileCode (anode);
982980
983- code.addByteCode(oCall, node.argumentList.list.Count);
981+ code.addByteCode(oCall, node.argumentList.list.Count, node.lineNumber );
984982 compileCode (node.primaryPlus);
985983end ;
986984
@@ -1041,7 +1039,7 @@ procedure TCompiler.compileCode(node: TASTNode);
10411039 ntSliceAll:
10421040 compileSliceAll (node);
10431041 ntSliceEqual:
1044- code.addByteCode(oPushi, SLICE_EQUAL);
1042+ code.addByteCode(oPushi, SLICE_EQUAL, 0 );
10451043 ntCreateList:
10461044 compileList(node as TASTCreatelist);
10471045 ntAssignment:
@@ -1123,16 +1121,16 @@ procedure TCompiler.compileCode(node: TASTNode);
11231121 ntBoolean:
11241122 code.addByteCode(oPushb, (node as TASTBoolean).bValue);
11251123 ntInteger:
1126- code.addByteCode(oPushi, (node as TASTInteger).iValue);
1124+ code.addByteCode(oPushi, (node as TASTInteger).iValue, node.lineNumber );
11271125 ntFloat:
11281126 begin
11291127 index := currentModule.moduleProgram.constantValueTable.Add (TConstantValueElement.Create((node as TASTFloat).dValue));
1130- code.addByteCode(oPushd, index);
1128+ code.addByteCode(oPushd, index, node.lineNumber );
11311129 end ;
11321130 ntString :
11331131 begin
11341132 index := currentmodule.moduleProgram.constantValueTable.Add (TConstantValueElement.Create ((node as TASTString).sValue));
1135- code.addByteCode(oPushs, index);
1133+ code.addByteCode(oPushs, index, node.lineNumber );
11361134 end ;
11371135 ntBreak:
11381136 // place holder for the jmp instruction
0 commit comments