class Opal::Nodes::ZsuperNode
super with explicit args
def block_name
def block_name case def_scope when Opal::Nodes::IterNode def_scope.block_name when Opal::Nodes::DefNode def_scope.block_name else raise "Don't know what to do with super in the scope #{def_scope}" end end
def compile
def compile if def_scope def_scope.uses_zuper = true implicit_args = [s(:js_tmp, '$zuper')] # If the method we're in has a block and we're using a default super call with no args, we need to grab the block # If an iter (block via braces) is provided, that takes precedence if block_name && !iter block_pass = s(:block_pass, s(:lvar, block_name)) implicit_args << block_pass end @arglist = s(:arglist, *implicit_args) end compile_using_send end
def compile_arguments
def compile_arguments push ', ' if arglist.children.empty? push '[]' else push expr(arglist) end end
def initialize(*)
def initialize(*) super # preserve a block if we have one already but otherwise, assume a block is coming from higher # up the chain unless iter.type == :iter # Need to support passing block up even if it's not referenced in this method at all scope.uses_block! @iter = s(:js_tmp, '$iter') end end