Class: Riml::CallNode
- Inherits:
-
Struct
- Object
- Struct
- Riml::CallNode
- Includes:
- Constants, FullyNameable, Visitable
- Defined in:
- lib/riml/nodes.rb
Overview
Node of a method call, can take any of these forms:
Method()
s:Method(argument1, argument2)
Direct Known Subclasses
Constant Summary collapse
- ALL_BUILTIN_FUNCTIONS =
BUILTIN_FUNCTIONS + BUILTIN_COMMANDS
- ALL_BUILTIN_COMMANDS =
BUILTIN_COMMANDS + RIML_COMMANDS + VIML_COMMANDS
Constants included from Visitable
Constants included from Constants
Riml::Constants::BUILTIN_COMMANDS, Riml::Constants::BUILTIN_FUNCTIONS, Riml::Constants::COMPARISON_OPERATORS, Riml::Constants::COMPILED_STRING_LOCATION, Riml::Constants::DEFINE_KEYWORDS, Riml::Constants::END_KEYWORDS, Riml::Constants::IGNORECASE_CAPABLE_OPERATORS, Riml::Constants::KEYWORDS, Riml::Constants::REGISTERS, Riml::Constants::RIML_CLASS_COMMANDS, Riml::Constants::RIML_COMMANDS, Riml::Constants::RIML_END_KEYWORDS, Riml::Constants::RIML_FILE_COMMANDS, Riml::Constants::RIML_KEYWORDS, Riml::Constants::SPECIAL_VARIABLE_PREFIXES, Riml::Constants::SPLAT_LITERAL, Riml::Constants::UNKNOWN_LOCATION_INFO, Riml::Constants::VIML_COMMANDS, Riml::Constants::VIML_END_KEYWORDS, Riml::Constants::VIML_KEYWORDS
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scope_modifier ⇒ Object
Returns the value of attribute scope_modifier.
-
#super_call ⇒ Object
(also: #super_call?)
Returns the value of attribute super_call.
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #parser_info, #scope
Instance Method Summary collapse
- #autoload? ⇒ Boolean
- #builtin_command? ⇒ Boolean
- #builtin_function? ⇒ Boolean
- #children ⇒ Object
- #force_newline_if_child_call_node? ⇒ Boolean
-
#initialize(scope_modifier, name, arguments) ⇒ CallNode
constructor
A new instance of CallNode.
- #method_call? ⇒ Boolean
- #must_be_explicit_call? ⇒ Boolean
- #remove_parens_wrapper ⇒ Object
Methods included from FullyNameable
Methods included from Visitable
Methods included from Walkable
#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with
Constructor Details
#initialize(scope_modifier, name, arguments) ⇒ CallNode
Returns a new instance of CallNode.
270 271 272 273 |
# File 'lib/riml/nodes.rb', line 270 def initialize(scope_modifier, name, arguments) super remove_parens_wrapper if builtin_command? end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments
260 261 262 |
# File 'lib/riml/nodes.rb', line 260 def arguments @arguments end |
#name ⇒ Object
Returns the value of attribute name
260 261 262 |
# File 'lib/riml/nodes.rb', line 260 def name @name end |
#scope_modifier ⇒ Object
Returns the value of attribute scope_modifier
260 261 262 |
# File 'lib/riml/nodes.rb', line 260 def scope_modifier @scope_modifier end |
#super_call ⇒ Object Also known as: super_call?
Returns the value of attribute super_call.
265 266 267 |
# File 'lib/riml/nodes.rb', line 265 def super_call @super_call end |
Instance Method Details
#autoload? ⇒ Boolean
304 305 306 |
# File 'lib/riml/nodes.rb', line 304 def autoload? name.include?('#') end |
#builtin_command? ⇒ Boolean
285 286 287 288 |
# File 'lib/riml/nodes.rb', line 285 def builtin_command? return false unless name.is_a?(String) scope_modifier.nil? and ALL_BUILTIN_COMMANDS.include?(name) end |
#builtin_function? ⇒ Boolean
280 281 282 283 |
# File 'lib/riml/nodes.rb', line 280 def builtin_function? return false unless name.is_a?(String) scope_modifier.nil? and ALL_BUILTIN_FUNCTIONS.include?(name) end |
#children ⇒ Object
312 313 314 315 316 317 318 |
# File 'lib/riml/nodes.rb', line 312 def children if name.is_a?(String) arguments else [name] + arguments end end |
#force_newline_if_child_call_node? ⇒ Boolean
308 309 310 |
# File 'lib/riml/nodes.rb', line 308 def force_newline_if_child_call_node? false end |
#method_call? ⇒ Boolean
296 297 298 299 300 |
# File 'lib/riml/nodes.rb', line 296 def method_call? name.instance_of?(DictGetDotNode) && name.dict.name == 'self' && name.dict.scope_modifier.nil? end |
#must_be_explicit_call? ⇒ Boolean
290 291 292 293 294 |
# File 'lib/riml/nodes.rb', line 290 def must_be_explicit_call? return false if builtin_command? return true if parent.instance_of?(Nodes) false end |
#remove_parens_wrapper ⇒ Object
275 276 277 278 |
# File 'lib/riml/nodes.rb', line 275 def remove_parens_wrapper return unless WrapInParensNode === arguments.first arguments[0] = arguments[0].expression end |