Class: Duby::AST::BlockArgument

Inherits:
Argument show all
Includes:
Named, Scoped
Defined in:
lib/duby/ast/method.rb

Instance Attribute Summary collapse

Attributes included from Named

#name

Attributes included from Typed

#type

Attributes inherited from Node

#children, #inferred_type, #newline, #parent, #position

Instance Method Summary collapse

Methods included from Scoped

#containing_scope, #scope

Methods included from Named

#to_s

Methods inherited from Argument

#resolved!

Methods inherited from Node

#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #expr?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

#initialize(parent, line_number, name) ⇒ BlockArgument

Returns a new instance of BlockArgument.



103
104
105
106
107
# File 'lib/duby/ast/method.rb', line 103

def initialize(parent, line_number, name)
  super(parent, line_number)

  @name = name
end

Instance Attribute Details

#optionalObject Also known as: optional?

Returns the value of attribute optional.



100
101
102
# File 'lib/duby/ast/method.rb', line 100

def optional
  @optional
end

Instance Method Details

#infer(typer) ⇒ Object



109
110
111
112
# File 'lib/duby/ast/method.rb', line 109

def infer(typer)
  scope.static_scope << name
  super
end