Class: Duby::AST::Ensure
- Defined in:
- lib/duby/ast/flow.rb,
lib/duby/compiler.rb,
lib/duby/jvm/source_generator/precompile.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#clause ⇒ Object
readonly
Returns the value of attribute clause.
-
#state ⇒ Object
Used by the some compilers.
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
- #compile(compiler, expression) ⇒ Object
- #ensures ⇒ Object
- #expr?(compiler) ⇒ Boolean
- #infer(typer) ⇒ Object
-
#initialize(parent, position, &block) ⇒ Ensure
constructor
A new instance of Ensure.
Methods inherited from Node
#[], #each, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s
Constructor Details
#initialize(parent, position, &block) ⇒ Ensure
Returns a new instance of Ensure.
311 312 313 314 |
# File 'lib/duby/ast/flow.rb', line 311 def initialize(parent, position, &block) super(parent, position, &block) @body, @clause = children end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
308 309 310 |
# File 'lib/duby/ast/flow.rb', line 308 def body @body end |
#clause ⇒ Object (readonly)
Returns the value of attribute clause.
308 309 310 |
# File 'lib/duby/ast/flow.rb', line 308 def clause @clause end |
#state ⇒ Object
Used by the some compilers.
309 310 311 |
# File 'lib/duby/ast/flow.rb', line 309 def state @state end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
255 256 257 258 |
# File 'lib/duby/compiler.rb', line 255 def compile(compiler, expression) compiler.line(line_number) compiler.ensure(self, expression) end |
#ensures ⇒ Object
323 324 325 |
# File 'lib/duby/ast/flow.rb', line 323 def ensures [self] end |
#expr?(compiler) ⇒ Boolean
138 139 140 |
# File 'lib/duby/jvm/source_generator/precompile.rb', line 138 def expr?(compiler) false end |
#infer(typer) ⇒ Object
316 317 318 319 320 321 |
# File 'lib/duby/ast/flow.rb', line 316 def infer(typer) resolve_if(typer) do typer.infer(clause) typer.infer(body) end end |