Class: Opal::Nodes::CallNode
Direct Known Subclasses
Defined Under Namespace
Classes: DependencyResolver
Constant Summary
- SPECIALS =
{}
- OPERATORS =
Operators that get optimized by compiler
{ :+ => :plus, :- => :minus, :* => :times, :/ => :divide, :< => :lt, :<= => :le, :> => :gt, :>= => :ge }
Instance Attribute Summary collapse
-
#arglist ⇒ Object
readonly
Returns the value of attribute arglist.
-
#iter ⇒ Object
readonly
Returns the value of attribute iter.
-
#meth ⇒ Object
readonly
Returns the value of attribute meth.
-
#recvr ⇒ Object
readonly
Returns the value of attribute recvr.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize ⇒ CallNode
constructor
A new instance of CallNode.
Methods inherited from Base
#add_gvar, #add_ivar, #add_local, #add_temp, #children, children, #class_variable_owner, #closest_module_node, #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
#initialize ⇒ CallNode
Returns a new instance of CallNode
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'opal/lib/opal/nodes/call.rb', line 26 def initialize(*) super @recvr, @meth, *args = *@sexp *rest, last_arg = *args if last_arg && [:iter, :block_pass].include?(last_arg.type) @iter = last_arg args = rest else @iter = nil end @arglist = s(:arglist, *args) end |
Instance Attribute Details
#arglist ⇒ Object (readonly)
Returns the value of attribute arglist
13 14 15 |
# File 'opal/lib/opal/nodes/call.rb', line 13 def arglist @arglist end |
#iter ⇒ Object (readonly)
Returns the value of attribute iter
13 14 15 |
# File 'opal/lib/opal/nodes/call.rb', line 13 def iter @iter end |
#meth ⇒ Object (readonly)
Returns the value of attribute meth
13 14 15 |
# File 'opal/lib/opal/nodes/call.rb', line 13 def meth @meth end |
#recvr ⇒ Object (readonly)
Returns the value of attribute recvr
13 14 15 |
# File 'opal/lib/opal/nodes/call.rb', line 13 def recvr @recvr end |
Class Method Details
.add_special(name, options = {}, &handler) ⇒ Object
21 22 23 24 |
# File 'opal/lib/opal/nodes/call.rb', line 21 def self.add_special(name, = {}, &handler) SPECIALS[name] = define_method("handle_#{name}", &handler) end |
Instance Method Details
#compile ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'opal/lib/opal/nodes/call.rb', line 42 def compile # handle some methods specially # some special methods need to skip compilation, so we pass the default as a block handle_special do compiler.method_calls << meth.to_sym if record_method? # if trying to access an lvar in irb mode return compile_irb_var if using_irb? default_compile end end |