Class: Duby::AST::ToString
- Inherits:
-
Node
- Object
- Node
- Duby::AST::ToString
show all
- Defined in:
- lib/duby/compiler.rb,
lib/duby/ast/literal.rb,
lib/duby/jvm/source_generator/precompile.rb
Instance Attribute Summary
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary
collapse
Methods inherited from Node
#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #to_s
Constructor Details
#initialize(parent, position) ⇒ ToString
Returns a new instance of ToString.
104
105
106
|
# File 'lib/duby/ast/literal.rb', line 104
def initialize(parent, position)
super(parent, position)
end
|
Instance Method Details
#compile(compiler, expression) ⇒ Object
39
40
41
|
# File 'lib/duby/compiler.rb', line 39
def compile(compiler, expression)
compiler.to_string(body, expression)
end
|
#expr?(compiler) ⇒ Boolean
136
137
138
|
# File 'lib/duby/jvm/source_generator/precompile.rb', line 136
def expr?(compiler)
body.expr?(compiler)
end
|
#infer(typer) ⇒ Object
108
109
110
111
112
113
114
115
|
# File 'lib/duby/ast/literal.rb', line 108
def infer(typer)
unless resolved?
body.infer(typer)
resolved! if body.resolved?
@inferred_type ||= typer.string_type
end
@inferred_type
end
|
#temp(compiler, value = nil) ⇒ Object
140
141
142
|
# File 'lib/duby/jvm/source_generator/precompile.rb', line 140
def temp(compiler, value=nil)
TempValue.new(body, compiler, value)
end
|