3 # Used for the Rubinius::asm Compiler hook.
5 class Compiler::ExecuteContext
14 attr_accessor :self, :file, :line, :metadata
24 def set_local(name, val)
73 @left.execute(e) and @right.execute(e)
79 @left.execute(e) or @right.execute(e)
109 ::Regexp.new(@source, @options)
132 ::Regexp.new super(e)
136 class DynamicOnceRegex
144 if @condition.execute(e)
145 @then.execute(e) if @then
147 @else.execute(e) if @else
155 while @condition.execute(e)
161 end while @condition.execute(e)
169 until @condition.execute(e)
175 end until @condition.execute(e)
197 class LocalAssignment
199 e.set_local @name, @value.execute(e)
205 @body.map { |x| x.execute(e) }
217 args = @body.map { |x| x.execute(e) }
227 e.self.instance_variable_get @name
235 md[@name] = @value.execute(e)
237 e.self.instance_variable_set @name, @value.execute(e)
250 ::Globals[@name] = @value.execute(e)
256 Object.const_get @name
262 par = @parent.execute(e)
269 Object.const_get @name
276 args = @arguments.map { |a| a.execute(e) }
282 vars = @block.arguments.names
283 blk = proc do |*args|
285 args.each_with_index do |a,i|
286 e.set_local vars[i], a
289 @block.body.execute(e)
292 @object.execute(e).__send__ @method, *args, &blk
294 @object.execute(e).__send__ @method, *args
301 args = @arguments.map { |a| a.execute(e) }
302 rhs = @rhs_expression.execute(e)
304 @object.execute(e).__send__ @method, *args
312 args = @arguments.map { |a| a.execute(e) }
318 vars = @block.arguments.names
319 blk = proc do |*args|
321 args.each_with_index do |a,i|
322 e.set_local vars[i], a
325 @block.body.execute(e)
327 e.self.__send__ @method, *args, &blk
329 e.self.__send__ @method, *args
336 e.self.__send__ @method
342 if @arguments.kind_of? Array
343 args = @arguments.map { |x| x.execute(e) }
345 args = @arguments.execute(e)
354 `#{@string.execute(e)}`
360 @child.execute(e).to_s
364 class DynamicExecuteString