class Yadriggy::LocalVarType
Type
of the value of a local variable.
Attributes
definition[R]
@return [ASTnode|Undef|nil] the AST node where the variable appears
for the first time, in other words, where the variable's type is defined. `Undef` if a value is assigned to the variable more than once. `nil` if an initial value has not been assigned to the variable yet.
Public Class Methods
new(type, definition)
click to toggle source
@param [Type] type a Type
object that this role is added to. @param [ASTnode|nil] definition the AST node of the local variable.
`nil` if an initial value is not set.
Calls superclass method
Yadriggy::OptionalRole::new
# File lib/yadriggy/type.rb, line 736 def initialize(type, definition) super(type) @definition = definition end
Public Instance Methods
definition=(ast)
click to toggle source
@param [ASTnode] ast the AST node of the local variable where
a new value is assigned to it.
@return [self]
# File lib/yadriggy/type.rb, line 744 def definition=(ast) if @definition.nil? @definition = ast else @definition = Undef end self end