diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb index 21aa2b09f5..11c682b7fa 100644 --- a/lib/rdoc/code_object.rb +++ b/lib/rdoc/code_object.rb @@ -69,13 +69,6 @@ class RDoc::CodeObject attr_reader :metadata - ## - # Offset in #file where this CodeObject was defined - #-- - # TODO character or byte? - - attr_accessor :offset - ## # Sets the parent CodeObject diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 087d56f7b9..0e72df2ecd 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -670,7 +670,6 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false tk.set_text body meth_obj.add_token tk meth_obj.comment = comment - meth_obj.offset = offset meth_obj.line = file_content[0, offset].count("\n") + 1 body @@ -689,7 +688,6 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false tk.set_text body meth_obj.add_token tk meth_obj.comment = comment - meth_obj.offset = offset meth_obj.line = file_content[0, offset].count("\n") + 1 body diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 9562ddbd7a..c5484e7cc5 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -589,7 +589,6 @@ def new_comment comment # +comment+. def parse_attr(context, single, tk, comment) - offset = tk.seek line_no = tk.line_no args = parse_symbol_arg 1 @@ -606,7 +605,6 @@ def parse_attr(context, single, tk, comment) end att = create_attr context, single, name, rw, comment - att.offset = offset att.line = line_no read_documentation_modifiers att, RDoc::ATTR_MODIFIERS @@ -620,7 +618,6 @@ def parse_attr(context, single, tk, comment) # comment for each to +comment+. def parse_attr_accessor(context, single, tk, comment) - offset = tk.seek line_no = tk.line_no args = parse_symbol_arg @@ -642,7 +639,6 @@ def parse_attr_accessor(context, single, tk, comment) for name in args att = create_attr context, single, name, rw, comment - att.offset = offset att.line = line_no end end @@ -651,7 +647,6 @@ def parse_attr_accessor(context, single, tk, comment) # Parses an +alias+ in +context+ with +comment+ def parse_alias(context, single, tk, comment) - offset = tk.seek line_no = tk.line_no skip_tkspace @@ -680,7 +675,6 @@ def parse_alias(context, single, tk, comment) al = RDoc::Alias.new(get_tkread, old_name, new_name, comment, single == SINGLE) record_location al - al.offset = offset al.line = line_no read_documentation_modifiers al, RDoc::ATTR_MODIFIERS @@ -733,7 +727,6 @@ def parse_call_parameters(tk) # Parses a class in +context+ with +comment+ def parse_class container, single, tk, comment - offset = tk.seek line_no = tk.line_no declaration_context = container @@ -748,7 +741,7 @@ def parse_class container, single, tk, comment case name = get_class_specification when 'self', container.name parse_statements container, SINGLE - return # don't update offset or line + return # don't update line else parse_class_singleton container, name, comment end @@ -757,7 +750,6 @@ def parse_class container, single, tk, comment return end - cls.offset = offset cls.line = line_no cls @@ -845,7 +837,6 @@ def parse_class_singleton container, name, comment # :nodoc: # true, no found constants will be added to RDoc. def parse_constant container, tk, comment, ignore_constants = false - offset = tk.seek line_no = tk.line_no name = tk.name @@ -885,7 +876,6 @@ def parse_constant container, tk, comment, ignore_constants = false value.replace body record_location con - con.offset = offset con.line = line_no read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS @@ -950,7 +940,6 @@ def parse_constant_body container, constant # :nodoc: def parse_comment container, tk, comment return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc' column = tk.char_no - offset = tk.seek line_no = tk.line_no text = comment.text @@ -966,7 +955,6 @@ def parse_comment container, tk, comment if co then co.singleton = singleton - co.offset = offset co.line = line_no end @@ -1031,19 +1019,18 @@ def parse_comment_ghost container, text, name, column, line_no, # :nodoc: def parse_comment_tomdoc container, tk, comment return unless signature = RDoc::TomDoc.signature(comment) - offset = tk.seek + column = tk.char_no line_no = tk.line_no name, = signature.split %r%[ \(]%, 2 meth = RDoc::GhostMethod.new get_tkread, name record_location meth - meth.offset = offset meth.line = line_no meth.start_collecting_tokens indent = TkSPACE.new 0, 1, 1 - indent.set_text " " * offset + indent.set_text " " * column position_comment = TkCOMMENT.new 0, line_no, 1 position_comment.set_text "# File #{@top_level.relative_name}, line #{line_no}" @@ -1183,7 +1170,6 @@ def parse_meta_attr(context, single, tk, comment) def parse_meta_method(container, single, tk, comment) column = tk.char_no - offset = tk.seek line_no = tk.line_no start_collecting_tokens @@ -1200,7 +1186,6 @@ def parse_meta_method(container, single, tk, comment) meth = RDoc::MetaMethod.new get_tkread, name record_location meth - meth.offset = offset meth.line = line_no meth.singleton = singleton @@ -1291,7 +1276,6 @@ def parse_method(container, single, tk, comment) added_container = false name = nil column = tk.char_no - offset = tk.seek line_no = tk.line_no start_collecting_tokens @@ -1309,7 +1293,6 @@ def parse_method(container, single, tk, comment) meth.singleton = single == SINGLE ? true : singleton record_location meth - meth.offset = offset meth.line = line_no meth.start_collecting_tokens diff --git a/test/test_rdoc_code_object.rb b/test/test_rdoc_code_object.rb index e0d89e4e67..be4ca268e4 100644 --- a/test/test_rdoc_code_object.rb +++ b/test/test_rdoc_code_object.rb @@ -276,12 +276,6 @@ def test_metadata assert_equal 'not_rdoc', @co.metadata['markup'] end - def test_offset - @c1_m.offset = 5 - - assert_equal 5, @c1_m.offset - end - def test_options assert_kind_of RDoc::Options, @co.options diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 09d7c4b16d..d0732597dc 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -1139,7 +1139,6 @@ def test_find_body_define assert_equal 'my_method', other_function.name assert_equal 'a comment for rb_other_function', other_function.comment.text assert_equal '()', other_function.params - assert_equal 118, other_function.offset assert_equal 8, other_function.line code = other_function.token_stream.first.text @@ -1173,7 +1172,6 @@ def test_find_body_define_comment assert_equal 'my_method', other_function.name assert_equal 'a comment for other_function', other_function.comment.text assert_equal '()', other_function.params - assert_equal 39, other_function.offset assert_equal 4, other_function.line code = other_function.token_stream.first.text @@ -1402,7 +1400,6 @@ def test_handle_method_args_minus_1 assert_equal 'm', m.name assert_equal @top_level, m.file - assert_equal 115, m.offset assert_equal 7, m.line assert_equal '(p1)', m.params diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 44b38c28aa..dfb73d27e2 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -297,7 +297,6 @@ def test_parse_alias assert_equal klass, alas.parent assert_equal 'comment', alas.comment assert_equal @top_level, alas.file - assert_equal 0, alas.offset assert_equal 1, alas.line end @@ -365,7 +364,6 @@ def test_parse_attr assert_equal 'foo', foo.name assert_equal 'my attr', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line end @@ -404,7 +402,6 @@ def test_parse_attr_accessor assert_equal 'RW', foo.rw assert_equal 'my attr', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line bar = klass.attributes.last @@ -617,7 +614,6 @@ def test_parse_class assert_equal 'Foo', foo.full_name assert_equal 'my class', foo.comment.text assert_equal [@top_level], foo.in_files - assert_equal 0, foo.offset assert_equal 1, foo.line end @@ -637,7 +633,6 @@ class << self c = @top_level.classes.first assert_equal 'C', c.full_name - assert_equal 0, c.offset assert_equal 1, c.line end @@ -727,7 +722,6 @@ def test_parse_class_nodoc assert_equal 'Foo', foo.full_name assert_empty foo.comment assert_equal [@top_level], foo.in_files - assert_equal 0, foo.offset assert_equal 1, foo.line end @@ -920,7 +914,6 @@ def foo; end assert_equal %w[A::B A::d], modules.map { |c| c.full_name } b = modules.first - assert_equal 10, b.offset assert_equal 2, b.line # make sure method/alias was not added to enclosing class/module @@ -1083,7 +1076,6 @@ def test_parse_comment_attr assert_equal 'RW', foo.rw assert_equal 'my attr', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line assert_equal nil, foo.viewer @@ -1147,7 +1139,6 @@ def test_parse_comment_method assert_equal 'foo', foo.name assert_equal 'my method', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line assert_equal [], foo.aliases @@ -1223,7 +1214,6 @@ def test_parse_constant assert_equal 'A', foo.name assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line end @@ -1389,7 +1379,6 @@ def test_parse_meta_method assert_equal 'foo', foo.name assert_equal 'my method', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line assert_equal [], foo.aliases @@ -1587,7 +1576,6 @@ def test_parse_method assert_equal 'foo', foo.name assert_equal 'my method', foo.comment.text assert_equal @top_level, foo.file - assert_equal 0, foo.offset assert_equal 1, foo.line assert_equal [], foo.aliases