Class: Opal::Nodes::NodeWithArgs
- Defined in:
- opal/lib/opal/nodes/node_with_args.rb
Instance Attribute Summary collapse
-
#arity ⇒ Object
Returns the value of attribute arity.
-
#original_args ⇒ Object
readonly
Returns the value of attribute original_args.
-
#used_kwargs ⇒ Object
readonly
Returns the value of attribute used_kwargs.
Attributes inherited from ScopeNode
#await_encountered, #block_name, #catch_return, #defs, #gvars, #has_break, #has_retry, #identity, #ivars, #locals, #methods, #mid, #name, #parent, #rescue_else_sexp, #scope_name
Attributes inherited from Base
Instance Method Summary collapse
- #arity_check_node ⇒ Object
-
#compile_arity_check ⇒ Object
Returns code used in debug mode to check arity of method call.
- #compile_block_arg ⇒ Object
-
#initialize ⇒ NodeWithArgs
constructor
A new instance of NodeWithArgs.
- #parameters_code ⇒ Object
Methods inherited from ScopeNode
#accepts_using?, #add_arg, #add_proto_ivar, #add_scope_gvar, #add_scope_ivar, #add_scope_local, #add_scope_temp, #class?, #class_scope?, #collect_refinements_temps, #current_rescue, #def?, #def_in_class?, #defines_lambda, #find_parent_def, #gen_retry_id, #has_local?, #has_rescue_else?, #has_temp?, #identify!, #in_ensure, #in_ensure?, #in_resbody, #in_resbody?, #in_rescue, #in_scope, #in_while?, #is_lambda!, #iter?, #lambda?, #lambda_definition?, #module?, #nesting, #new_refinements_temp, #new_temp, #next_temp, #pop_while, #prepare_block, #push_while, #queue_temp, #refinements_temp, #relative_access, #sclass?, #scope_locals, #self, #super_chain, #to_vars, #top?, #uses_block!, #uses_block?
Methods inherited from Base
#add_gvar, #add_ivar, #add_local, #add_temp, children, #children, #class_variable_owner, #class_variable_owner_nesting_level, #comments, #compile, #compile_to_fragments, #error, #expr, #expr?, #expr_or_nil, #fragment, handle, handlers, #has_rescue_else?, #helper, #in_ensure, #in_ensure?, #in_resbody, #in_resbody?, #in_rescue, #in_while?, #process, #push, #recv, #recv?, #s, #scope, #source_location, #stmt, #stmt?, #top_scope, truthy_optimize?, #unshift, #while_loop, #with_temp, #wrap
Methods included from Helpers
#conditional_send, #current_indent, #empty_line, #indent, #js_truthy, #js_truthy_optimize, #line, #mid_to_jsid, #property, #valid_name?
Constructor Details
#initialize ⇒ NodeWithArgs
Returns a new instance of NodeWithArgs.
13 14 15 16 17 18 19 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 13 def initialize(*) super @original_args = @sexp.[:original_args] @used_kwargs = [] @arity = 0 end |
Instance Attribute Details
#arity ⇒ Object
Returns the value of attribute arity.
10 11 12 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 10 def arity @arity end |
#original_args ⇒ Object (readonly)
Returns the value of attribute original_args.
11 12 13 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 11 def original_args @original_args end |
#used_kwargs ⇒ Object (readonly)
Returns the value of attribute used_kwargs.
9 10 11 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 9 def used_kwargs @used_kwargs end |
Instance Method Details
#arity_check_node ⇒ Object
21 22 23 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 21 def arity_check_node s(:arity_check, original_args) end |
#compile_arity_check ⇒ Object
Returns code used in debug mode to check arity of method call
26 27 28 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 26 def compile_arity_check push process(arity_check_node) end |
#compile_block_arg ⇒ Object
30 31 32 33 34 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 30 def compile_block_arg if scope.uses_block? scope.prepare_block end end |
#parameters_code ⇒ Object
36 37 38 |
# File 'opal/lib/opal/nodes/node_with_args.rb', line 36 def parameters_code Args::Parameters.new(original_args).to_code end |