Class: Duby::AST::WhileLoop
- Defined in:
- lib/duby/ast/flow.rb,
lib/duby/compiler.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#check_first ⇒ Object
Returns the value of attribute check_first.
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#negative ⇒ Object
Returns the value of attribute negative.
Attributes inherited from Loop
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
- #check_first? ⇒ Boolean
- #compile(compiler, expression) ⇒ Object
- #has_redo? ⇒ Boolean
-
#initialize(parent, line_number, check_first, negative, &block) ⇒ WhileLoop
constructor
A new instance of WhileLoop.
- #negative? ⇒ Boolean
- #to_s ⇒ Object
Methods inherited from Loop
Methods inherited from Node
#[], #each, #expr?, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp
Constructor Details
#initialize(parent, line_number, check_first, negative, &block) ⇒ WhileLoop
Returns a new instance of WhileLoop.
116 117 118 119 120 121 |
# File 'lib/duby/ast/flow.rb', line 116 def initialize(parent, line_number, check_first, negative, &block) super(parent, line_number, &block) @condition, @body = children @check_first = check_first @negative = negative end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
114 115 116 |
# File 'lib/duby/ast/flow.rb', line 114 def body @body end |
#check_first ⇒ Object
Returns the value of attribute check_first.
114 115 116 |
# File 'lib/duby/ast/flow.rb', line 114 def check_first @check_first end |
#condition ⇒ Object
Returns the value of attribute condition.
114 115 116 |
# File 'lib/duby/ast/flow.rb', line 114 def condition @condition end |
#negative ⇒ Object
Returns the value of attribute negative.
114 115 116 |
# File 'lib/duby/ast/flow.rb', line 114 def negative @negative end |
Instance Method Details
#check_first? ⇒ Boolean
123 |
# File 'lib/duby/ast/flow.rb', line 123 def check_first?; @check_first; end |
#compile(compiler, expression) ⇒ Object
153 154 155 156 |
# File 'lib/duby/compiler.rb', line 153 def compile(compiler, expression) compiler.line(line_number) compiler.while_loop(self, expression) end |
#to_s ⇒ Object
127 128 129 |
# File 'lib/duby/ast/flow.rb', line 127 def to_s "WhileLoop(check_first = #{check_first?}, negative = #{negative?})" end |