Class: TypedRb::Model::TmFor
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
Attributes inherited from Expr
Instance Method Summary collapse
- #check_type(context) ⇒ Object
-
#initialize(condition, body, node) ⇒ TmFor
constructor
A new instance of TmFor.
Constructor Details
#initialize(condition, body, node) ⇒ TmFor
Returns a new instance of TmFor.
8 9 10 11 12 |
# File 'lib/typed/model/tm_for.rb', line 8 def initialize(condition, body, node) super(node) @condition = condition @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/typed/model/tm_for.rb', line 7 def body @body end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
7 8 9 |
# File 'lib/typed/model/tm_for.rb', line 7 def condition @condition end |
Instance Method Details
#check_type(context) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/typed/model/tm_for.rb', line 14 def check_type(context) condition.check_type(context) result_type = body.check_type(context) if result_type.stack_jump? && (result_type.next? || result_type.break?) result_type.wrapped_type.check_type(context) elsif result_type.either? process_either_type(result_type, context) else result_type end end |