Permalink
Browse files

Ignore @!method directive errors.

  • Loading branch information...
castwide committed Jan 8, 2019
1 parent 90530a4 commit 3d4cc5450cacb420a0a9d6c27ef9e8260fcb36e3
Showing with 12 additions and 1 deletion.
  1. +2 −1 lib/solargraph/source_map/mapper.rb
  2. +10 −0 spec/source_map/mapper_spec.rb
@@ -72,7 +72,8 @@ def process_directive position, directive
when 'method'
namespace = namespace_at(position)
gen_src = Solargraph::SourceMap.load_string("def #{directive.tag.name};end")
gen_pin = gen_src.pins.last # Method is last pin after root namespace
gen_pin = gen_src.pins.select{ |p| p.kind == Pin::METHOD }.first
return if gen_pin.nil?
@pins.push Solargraph::Pin::Method.new(location, namespace.path, gen_pin.name, docstring.all, :instance, :public, gen_pin.parameters, nil)
when 'attribute'
namespace = namespace_at(position)
@@ -922,4 +922,14 @@ def pro; end
pro = smap.pins.select{|pin| pin.path == 'Foo#pro'}.first
expect(pro.visibility).to eq(:protected)
end

it "ignores errors in method directives" do
expect {
Solargraph::SourceMap.load_string(%[
class Foo
# @!method bar(
end
])
}.not_to raise_error
end
end

0 comments on commit 3d4cc54

Please sign in to comment.