class Opal::Nodes::BaseSuperNode
call.
body. This is then used by actual super calls, or a defined?(super) style
This base class is used just to child the find_super_dispatcher method
def add_method(temporary_receiver)
def add_method(temporary_receiver) super_call = if scope.def? super_method_invocation elsif scope.iter? super_block_invocation else raise 'unexpected compilation error' end if temporary_receiver push "(#{temporary_receiver} = ", receiver_fragment, ", ", super_call, ")" else push super_call end end
def arguments_array?
def arguments_array? # zuper is an implicit super argument array super || @implicit_args end
def compile
def compile if scope.def? scope.uses_block! end default_compile end
def containing_def_scope
def containing_def_scope return scope if scope.def? # using super in a block inside a method is allowed, e.g. # def a # { super } # end scope.find_parent_def end
def defined_check_param
def defined_check_param 'false' end
def implicit_arguments_param
def implicit_arguments_param @implicit_args ? 'true' : 'false' end
def iter
def iter # Need to support passing block up even if it's not referenced in this method at all @iter ||= begin if raw_iter raw_iter elsif arglist # TODO: Better understand this elsif vs. the else code path s(:js_tmp, 'null') else scope.uses_block! s(:js_tmp, '$iter') end end end
def method_jsid
def method_jsid raise 'Not implemented, see #add_method' end
def recvr
def recvr s(:self) end
def redefine_this?(temporary_receiver)
def redefine_this?(temporary_receiver) true end
def super_block_invocation
def super_block_invocation chain, cur_defn, mid = scope.get_super_chain trys = chain.map { |c| "#{c}.$$def" }.join(' || ') implicit = @implicit_args.to_s "Opal.find_iter_super_dispatcher(self, #{mid}, (#{trys} || #{cur_defn}), #{defined_check_param}, #{implicit_arguments_param})" end
def super_method_invocation
def super_method_invocation def_scope = containing_def_scope method_jsid = def_scope.mid.to_s current_func = def_scope.identify! if def_scope.defs class_name = def_scope.parent.name ? "$#{def_scope.parent.name}" : 'self.$$class.$$proto' "Opal.find_super_dispatcher(self, '#{method_jsid}', #{current_func}, #{defined_check_param}, #{class_name})" else "Opal.find_super_dispatcher(self, '#{method_jsid}', #{current_func}, #{defined_check_param})" end end