1 # depends on: method_context.rb block_environment.rb
4 # Stores all information about a running BlockEnvironment.
6 # A BlockContext contains a home and a BlockEnvironment in addition to a
7 # MethodContext. The home points to the MethodContext that encloses the
8 # block which is used to find self, etc.
10 class BlockContext < MethodContext
20 def last_match=(match)
21 home.last_match = match
33 @method_scope || env.home_block.method_scope
37 # Active context (instance of MethodContext) that started
38 # execution of this block context.
45 # Name of home method.
52 # Block context has no receiver thus uses receiver from it's home method
60 # Block context has no own module thus uses module from it's home method
68 # Static scope of home method context.
71 if ss = method.staticscope
79 # instance_eval needs alternate const behavior
81 def __const_set__(name, value)
82 const_scope = env.constant_scope.module
83 const_scope.__send__(:__const_set__, name, value)