зеркало из https://github.com/github/ruby.git
ripper/lexer.rb: dispatch alias
* ext/ripper/lib/ripper/lexer.rb: alias same methods instead of eval for each events. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
cf2b422fc5
Коммит
ef44c0ad2f
|
@ -60,12 +60,12 @@ class Ripper
|
|||
|
||||
private
|
||||
|
||||
def _push_token(tok)
|
||||
@buf.push [[lineno(), column()], __callee__, tok]
|
||||
end
|
||||
|
||||
SCANNER_EVENTS.each do |event|
|
||||
module_eval(<<-End, __FILE__+'/module_eval', __LINE__ + 1)
|
||||
def on_#{event}(tok)
|
||||
@buf.push [[lineno(), column()], :on_#{event}, tok]
|
||||
end
|
||||
End
|
||||
alias_method "on_#{event}", :_push_token
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче