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 compile_method
def compile_method push ', ' if scope.def? push super_method_invocation elsif scope.iter? push super_block_invocation else raise 'super must be called from method body or block' end end
def compile_using_send
def compile_using_send helper :send push '$send(' compile_receiver compile_method compile_arguments compile_block_pass push ')' end
def def_scope
end
{ super }
def a
Using super in a block inside a method is allowed, e.g.
def def_scope @def_scope ||= scope.def? ? scope : scope.find_parent_def end
def def_scope_identity
def def_scope_identity def_scope.identify!(def_scope.mid) end
def defined_check_param
def defined_check_param raise_exception? ? 'true' : 'false' end
def implicit_args?
def implicit_args? @sexp.type == :zsuper end
def implicit_arguments_param
def implicit_arguments_param implicit_args? ? 'true' : 'false' end
def initialize(*)
def initialize(*) super args = *@sexp *rest, last_child = *args if last_child && %i[iter block_pass].include?(last_child.type) @iter = last_child args = rest else @iter = s(:js_tmp, 'null') end @arglist = s(:arglist, *args) @recvr = s(:self) end
def method_id
def method_id def_scope.mid.to_s end
def raise_exception?
def raise_exception? @sexp.type == :defined_super end
def super_block_invocation
def super_block_invocation chain, cur_defn, mid = scope.super_chain trys = chain.map { |c| "#{c}.$$def" }.join(' || ') "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 if def_scope.defs "Opal.find_super_dispatcher(self, '#{method_id}', #{def_scope_identity}, #{defined_check_param}, self.$$class.$$prototype)" else "Opal.find_super_dispatcher(self, '#{method_id}', #{def_scope_identity}, #{defined_check_param})" end end