mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/racc] Remove Object monkey patch
I don't think we need this monkey patch anymore, so lets remove it!
464485e912
This commit is contained in:
parent
7641a83d1f
commit
b036a44e57
1 changed files with 2 additions and 8 deletions
|
@ -12,12 +12,6 @@
|
||||||
|
|
||||||
require 'racc/parser'
|
require 'racc/parser'
|
||||||
|
|
||||||
unless Object.method_defined?(:funcall)
|
|
||||||
class Object
|
|
||||||
alias funcall __send__
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module Racc
|
module Racc
|
||||||
|
|
||||||
StateTransitionTable = Struct.new(:action_table,
|
StateTransitionTable = Struct.new(:action_table,
|
||||||
|
@ -300,9 +294,9 @@ module Racc
|
||||||
c.module_eval "def _reduce_none(vals, vstack) vals[0] end"
|
c.module_eval "def _reduce_none(vals, vstack) vals[0] end"
|
||||||
@grammar.each do |rule|
|
@grammar.each do |rule|
|
||||||
if rule.action.empty?
|
if rule.action.empty?
|
||||||
c.funcall(:alias_method, "_reduce_#{rule.ident}", :_reduce_none)
|
c.alias_method("_reduce_#{rule.ident}", :_reduce_none)
|
||||||
else
|
else
|
||||||
c.funcall(:define_method, "_racc_action_#{rule.ident}", &rule.action.proc)
|
c.define_method("_racc_action_#{rule.ident}", &rule.action.proc)
|
||||||
c.module_eval(<<-End, __FILE__, __LINE__ + 1)
|
c.module_eval(<<-End, __FILE__, __LINE__ + 1)
|
||||||
def _reduce_#{rule.ident}(vals, vstack)
|
def _reduce_#{rule.ident}(vals, vstack)
|
||||||
_racc_action_#{rule.ident}(*vals)
|
_racc_action_#{rule.ident}(*vals)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue