Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supply location info to class_eval #50

Closed
wants to merge 1 commit into from
Closed

Supply location info to class_eval #50

wants to merge 1 commit into from

Conversation

taichi-ishitani
Copy link
Contributor

@taichi-ishitani taichi-ishitani commented Dec 20, 2020

Currently class_eval has no location info so caller location of FallbackContextProxy#method_missing is not understandable.
(see following example.)
This PR is fix this problem.

For example:

Sample code:

require 'docile'

class Foo
  def bar
    puts caller_locations
  end
end

Docile.dsl_eval(Foo.new) { bar }

Current caller locations:

(eval):3:in `method_missing'
test.rb:9:in `block in <main>'
/opt/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/docile-1.3.3/lib/docile/execution.rb:26:in `instance_exec'
/opt/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/docile-1.3.3/lib/docile/execution.rb:26:in `exec_in_proxy_context'
test.rb:9:in `<main>'

Better and expected caller locations:

/home/taichi/workspace/ruby_etc/docile/lib/docile/fallback_context_proxy.rb:94:in `method_missing'
test.rb:9:in `block in <main>'
/home/taichi/workspace/ruby_etc/docile/lib/docile/execution.rb:26:in `instance_exec'
/home/taichi/workspace/ruby_etc/docile/lib/docile/execution.rb:26:in `exec_in_proxy_context'
/home/taichi/workspace/ruby_etc/docile/lib/docile.rb:44:in `dsl_eval'
test.rb:9:in `<main>'

@codecov-io
Copy link

codecov-io commented Dec 20, 2020

Codecov Report

Merging #50 (3a9a18a) into master (f065fc3) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #50   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines           82        82           
=========================================
  Hits            82        82           
Impacted Files Coverage Δ
lib/docile/fallback_context_proxy.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f065fc3...3a9a18a. Read the comment docs.

taichi-ishitani added a commit to rggen/rggen-core that referenced this pull request Dec 21, 2020
taichi-ishitani added a commit to rggen/rggen-core that referenced this pull request Dec 21, 2020
taichi-ishitani added a commit to rggen/rggen-core that referenced this pull request Dec 21, 2020
@taichi-ishitani
Copy link
Contributor Author

#51 includes my PR so I close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants