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

Removed changing constant lookup scope in compiled templates. #279

Closed
wants to merge 1 commit into from

Conversation

printercu
Copy link

It singificantly simplifies code and removes extra lines with
wrong source locations from backtrace.

Without this commit backtrace is:

test.str:13:in `block in singleton class'
test.str:7:in `instance_eval'
test.str:7:in `singleton class'
test.str:5:in `__tilt_70221264454100'
.../tilt/lib/tilt/template.rb:165:in `call'
...

After:

test.str:13:in `__tilt_70182127403480'
.../tilt/lib/tilt/template.rb:165:in `call'

It's especially confusing when used with real files, because locations point to other source.
This can also be avoided by using method_source.lines.map(&:strip).join('; ') to concat lines. But I think it's not a big problem to use self.class::CONST instead of just COST even explicit constant lookup.

It significantly simplifies code and removes extra lines with
wrong source locations from backtrace.
@judofyr
Copy link
Collaborator

judofyr commented Mar 30, 2016

This is a breaking change which I'm not quite ready to make. Some people might actually use proper namespacing and depend on constant lookup being relative to self (which is quite sensible).

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