Class: Mirah::AST::Self
- Includes:
- Scoped
- Defined in:
- lib/mirah/ast/literal.rb,
lib/mirah/compiler/literal.rb
Instance Attribute Summary
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
Methods included from Scoped
Methods inherited from Node
#<<, ===, #[], #[]=, #_dump, _load, #_set_parent, child, child_name, #child_nodes, #each, #empty?, #expr?, #inferred_type!, #initialize, #initialize_copy, #insert, #inspect, #inspect_children, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #string_value, #temp, #to_s, #top_level?, #validate_child, #validate_children
Constructor Details
This class inherits a constructor from Mirah::AST::Node
Instance Method Details
#compile(compiler, expression) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/mirah/compiler/literal.rb', line 120 def compile(compiler, expression) if expression compiler.line(line_number) compiler.compile_self end rescue Exception => ex raise Mirah::InternalCompilerError.wrap(ex, self) end |
#infer(typer, expression) ⇒ Object
174 175 176 |
# File 'lib/mirah/ast/literal.rb', line 174 def infer(typer, expression) @inferred_type ||= scope.static_scope.self_type end |