protected static int FindStopTokenIndexForRemoval(VBAParser.MainBlockStmtContext mainBlockStmt) { return(FindStopTokenIndexForRemoval((VBAParser.BlockStmtContext)mainBlockStmt.Parent)); }
protected static int FindStopTokenIndex(IReadOnlyList <VBAParser.BlockStmtContext> blockStmts, VBAParser.MainBlockStmtContext mainBlockStmt, VBAParser.BlockContext block) { for (var i = 0; i < blockStmts.Count; i++) { if (blockStmts[i].mainBlockStmt() != mainBlockStmt) { continue; } if (blockStmts[i].statementLabelDefinition() != null) { return(mainBlockStmt.Stop.TokenIndex); //Removing the following endOfStatement if there is a label on the line would break the code. } return(FindStopTokenIndex(block, i)); } return(mainBlockStmt.Stop.TokenIndex); }