Class: Opal::Nodes::JsCallNode

Inherits:
CallNode show all
Defined in:
opal/lib/opal/nodes/call_special.rb

Constant Summary

Constants inherited from CallNode

CallNode::OPERATORS, CallNode::SPECIALS

Instance Attribute Summary

Attributes inherited from CallNode

#arglist, #iter, #meth, #recvr

Attributes inherited from Base

#compiler, #type

Instance Method Summary collapse

Methods inherited from CallNode

add_special

Methods inherited from Base

#add_gvar, #add_ivar, #add_local, #add_temp, #children, children, #class_variable_owner, #class_variable_owner_nesting_level, #comments, #compile_to_fragments, #error, #expr, #expr?, #expr_or_nil, #fragment, handle, handlers, #has_rescue_else?, #helper, #in_ensure, #in_ensure?, #in_while?, #process, #push, #recv, #recv?, #s, #scope, #stmt, #stmt?, truthy_optimize?, #unshift, #while_loop, #with_temp, #wrap

Methods included from Helpers

#conditional_send, #current_indent, #empty_line, #indent, #js_falsy, #js_truthy, #js_truthy_optimize, #line, #mid_to_jsid, #property, #valid_name?

Constructor Details

#initializeJsCallNode

Returns a new instance of JsCallNode.



34
35
36
37
38
39
40
41
42
43
# File 'opal/lib/opal/nodes/call_special.rb', line 34

def initialize(*)
  super

  # For .JS. call we pass a block
  # as a plain JS callback
  if @iter
    @arglist = @arglist << @iter
  end
  @iter = nil
end

Instance Method Details

#compileObject



45
46
47
# File 'opal/lib/opal/nodes/call_special.rb', line 45

def compile
  default_compile
end

#compile_using_sendObject



53
54
55
56
57
58
59
60
# File 'opal/lib/opal/nodes/call_special.rb', line 53

def compile_using_send
  push recv(receiver_sexp), method_jsid, '.apply(null'
  compile_arguments
  if iter
    push '.concat(', expr(iter), ')'
  end
  push ')'
end

#method_jsidObject



49
50
51
# File 'opal/lib/opal/nodes/call_special.rb', line 49

def method_jsid
  ".#{meth}"
end