Class: Duby::AST::RequiredArgument
- Defined in:
- lib/duby/ast/method.rb
Instance Attribute Summary
Attributes included from Named
Attributes included from Typed
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
- #infer(typer) ⇒ Object
-
#initialize(parent, line_number, name) ⇒ RequiredArgument
constructor
A new instance of RequiredArgument.
Methods included from Scoped
Methods included from Named
Methods inherited from Argument
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) ⇒ RequiredArgument
Returns a new instance of RequiredArgument.
38 39 40 41 42 |
# File 'lib/duby/ast/method.rb', line 38 def initialize(parent, line_number, name) super(parent, line_number) @name = name end |
Instance Method Details
#infer(typer) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/duby/ast/method.rb', line 44 def infer(typer) resolve_if(typer) do scope.static_scope << name # if not already typed, check parent of parent (MethodDefinition) # for signature info method_def = parent.parent signature = method_def.signature # if signature, search for this argument signature[name.intern] || typer.local_type(scope, name) end end |