Class: Rubex::AST::Statement::ArgumentList

Inherits:
Base
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rubex/ast/statement/argument_list.rb

Overview

This node is used for both formal and actual arguments of functions/methods.

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#generate_code, #statement?

Constructor Details

#initialize(args) ⇒ ArgumentList

Returns a new instance of ArgumentList.



23
24
25
# File 'lib/rubex/ast/statement/argument_list.rb', line 23

def initialize(args)
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

args - [ArgDeclaration]



9
10
11
# File 'lib/rubex/ast/statement/argument_list.rb', line 9

def args
  @args
end

Instance Method Details

#<<(arg) ⇒ Object



37
38
39
# File 'lib/rubex/ast/statement/argument_list.rb', line 37

def <<(arg)
  push arg
end

#==(other) ⇒ Object



41
42
43
# File 'lib/rubex/ast/statement/argument_list.rb', line 41

def ==(other)
  self.class == other.class && @args == other.args
end

#[](idx) ⇒ Object



53
54
55
# File 'lib/rubex/ast/statement/argument_list.rb', line 53

def [](idx)
  @args[idx]
end

#analyse_statement(local_scope, extern: false) ⇒ Object



27
28
29
30
31
# File 'lib/rubex/ast/statement/argument_list.rb', line 27

def analyse_statement(local_scope, extern: false)
  @args.each do |arg|
    arg.analyse_types(local_scope, extern: extern)
  end
end

#each(&block) ⇒ Object



11
12
13
# File 'lib/rubex/ast/statement/argument_list.rb', line 11

def each(&block)
  @args.each(&block)
end

#empty?Boolean

Returns:



49
50
51
# File 'lib/rubex/ast/statement/argument_list.rb', line 49

def empty?
  @args.empty?
end

#map!(&block) ⇒ Object



15
16
17
# File 'lib/rubex/ast/statement/argument_list.rb', line 15

def map!(&block)
  @args.map!(&block)
end

#popObject



19
20
21
# File 'lib/rubex/ast/statement/argument_list.rb', line 19

def pop
  @args.pop
end

#push(arg) ⇒ Object



33
34
35
# File 'lib/rubex/ast/statement/argument_list.rb', line 33

def push(arg)
  @args << arg
end

#sizeObject



45
46
47
# File 'lib/rubex/ast/statement/argument_list.rb', line 45

def size
  @args.size
end