Class: Duby::JVM::Types::FixnumLiteralNode

Inherits:
AST::Fixnum show all
Defined in:
lib/duby/jvm/types/factory.rb

Instance Attribute Summary

Attributes included from AST::Literal

#literal

Attributes included from AST::Typed

#type

Attributes inherited from AST::Node

#children, #inferred_type, #newline, #parent, #position

Instance Method Summary collapse

Methods inherited from AST::Fixnum

#==, #eql?, #initialize

Methods included from AST::Literal

#to_s

Methods inherited from AST::Node

#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #expr?, #initialize, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

This class inherits a constructor from Duby::AST::Fixnum

Instance Method Details

#compile(compiler, expression) ⇒ Object



171
172
173
174
175
# File 'lib/duby/jvm/types/factory.rb', line 171

def compile(compiler, expression)
  if expression
    inferred_type.literal(compiler.method, @literal)
  end
end

#infer(typer) ⇒ Object



165
166
167
168
169
# File 'lib/duby/jvm/types/factory.rb', line 165

def infer(typer)
  return @inferred_type if resolved?
  resolved!
  @inferred_type = FixnumLiteral.new(@literal)
end