@@ -730,22 +730,21 @@ def self.instrument_script(text, filename, mark_private = false)
730
730
instrumented_text = ''
731
731
732
732
@cancel_instrumentation = false
733
- comments_removed_text = ruby_lex_utils . remove_comments ( text )
734
- num_lines = comments_removed_text . num_lines . to_f
733
+ num_lines = text . num_lines . to_f
735
734
num_lines = 1 if num_lines < 1
736
735
instrumented_text =
737
736
instrument_script_implementation ( ruby_lex_utils ,
738
- comments_removed_text ,
739
- num_lines ,
740
- filename ,
741
- mark_private )
737
+ text ,
738
+ num_lines ,
739
+ filename ,
740
+ mark_private )
742
741
743
742
raise OpenC3 ::StopScript if @cancel_instrumentation
744
743
instrumented_text
745
744
end
746
745
747
746
def self . instrument_script_implementation ( ruby_lex_utils ,
748
- comments_removed_text ,
747
+ text ,
749
748
_num_lines ,
750
749
filename ,
751
750
mark_private = false )
@@ -755,14 +754,12 @@ def self.instrument_script_implementation(ruby_lex_utils,
755
754
instrumented_text = ''
756
755
end
757
756
758
- ruby_lex_utils . each_lexed_segment ( comments_removed_text ) do |segment , instrumentable , inside_begin , line_no |
757
+ ruby_lex_utils . each_lexed_segment ( text ) do |segment , instrumentable , inside_begin , line_no |
759
758
return nil if @cancel_instrumentation
760
759
instrumented_line = ''
761
760
if instrumentable
762
761
# Add a newline if it's empty to ensure the instrumented code has
763
- # the same number of lines as the original script. Note that the
764
- # segment could have originally had comments but they were stripped in
765
- # ruby_lex_utils.remove_comments
762
+ # the same number of lines as the original script
766
763
if segment . strip . empty?
767
764
instrumented_text << "\n "
768
765
next
0 commit comments