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 allow_stubs
def allow_stubs 'true' end
def compile_method_body
def compile_method_body 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_method_name
def compile_method_name if scope.def? push ", '#{method_id}'" elsif scope.iter? _chain, _cur_defn, mid = scope.super_chain push ", #{mid}" end end
def compile_using_send
def compile_using_send helper :send2 push '$send2(' compile_receiver compile_method_body compile_method_name 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 'false' end
def implicit_arguments_param
def implicit_arguments_param '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 super_block_invocation
def super_block_invocation helper :find_block_super chain, cur_defn, mid = scope.super_chain trys = chain.map { |c| "#{c}.$$def" }.join(' || ') "$find_block_super(#{scope.self}, #{mid}, (#{trys} || #{cur_defn}), #{defined_check_param}, #{implicit_arguments_param})" end
def super_method_invocation
def super_method_invocation helper :find_super "$find_super(#{scope.self}, '#{method_id}', #{def_scope_identity}, #{defined_check_param}, #{allow_stubs})" end