Class: RubyRunJs::OPCODES::WITH
- Defined in:
- lib/ruby_run_js/opcodes.rb
Instance Method Summary collapse
- #eval(ctx) ⇒ Object
-
#initialize(label_start, label_end) ⇒ WITH
constructor
A new instance of WITH.
Methods inherited from OP_CODE
Methods included from RubyRunJs::Operation
#abstract_equality_op, #abstract_inequality_op, #abstract_relational_comparison, #add_op, #binary_operation, #bit_and_op, #bit_bshift_op, #bit_invert_uop, #bit_lshift_op, #bit_or_op, #bit_rshift_op, #bit_xor_op, #div_op, #float, #greater_eq_op, #greater_op, #in_op, #instanceof_op, #less_eq_op, #less_op, #logical_negation_uop, #minus_uop, #mod_op, #mul_op, #plus_uop, #strict_equality_op, #strict_inequality_op, #sub_op, #typeof_uop, #unary_operation, #void_op
Methods included from Helper
#check_object, #get_member, #get_member_dot, #is_accessor_descriptor, #is_callable, #is_data_descriptor, #is_generic_descriptor, #is_primitive, #make_error, #strict_equality
Methods included from ConversionHelper
#convert_to_js_type, #to_boolean, #to_int32, #to_integer, #to_number, #to_object, #to_primitive, #to_string, #to_uint16, #to_uint32
Constructor Details
#initialize(label_start, label_end) ⇒ WITH
Returns a new instance of WITH.
829 830 831 832 |
# File 'lib/ruby_run_js/opcodes.rb', line 829 def initialize(label_start, label_end) @label_start = label_start @label_end = label_end end |
Instance Method Details
#eval(ctx) ⇒ Object
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 |
# File 'lib/ruby_run_js/opcodes.rb', line 834 def eval(ctx) obj = to_object(ctx.stack.pop(), ctx.builtin) scope = ObjectScope.new(obj, ctx, ctx.builtin) scope.this_binding = ctx.this_binding status = ctx.builtin.executor.run_under_control( \ scope, @label_start, @label_end) ctx.stack.pop() type, return_value, label = status if type == 0 # normal ctx.stack.append(return_value) return nil elsif type == 1 # return ctx.stack.append(return_value) return :Return # send return signal elsif type == 2 # jump outside ctx.stack.append(return_value) return label elsif type == 3 # throw is made with empty stack as usual raise return_value else raise "Unexpected Type: #{type}" end end |