Class: Rubycc::Front::AST::Program

Inherits:
Data
  • Object
show all
Defined in:
lib/rubycc/front/ast.rb

Overview

Whole translation unit. functions is an array of FunctionDef, FunctionDecl (prototype) and GlobalDecl (file-scope variable) nodes in source order. init_attributes maps a function name to the InitAttributes its declarations carried; it is a property of the unit rather than of any one node because the attribute may be written on a prototype that precedes or follows the definition (see Parser#register_init_attributes). Names never defined here appear in it too and are dropped by the generator. visibility_attributes maps an identifier to an explicit GNU ELF visibility; it is kept at program scope because an exported declaration often precedes its definition.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(functions:, init_attributes: {}, visibility_attributes: {}) ⇒ Program

Returns a new instance of Program.



522
523
524
# File 'lib/rubycc/front/ast.rb', line 522

def initialize(functions:, init_attributes: {}, visibility_attributes: {})
  super
end

Instance Attribute Details

#functionsObject (readonly)

Returns the value of attribute functions

Returns:

  • (Object)

    the current value of functions



521
522
523
# File 'lib/rubycc/front/ast.rb', line 521

def functions
  @functions
end

#init_attributesObject (readonly)

Returns the value of attribute init_attributes

Returns:

  • (Object)

    the current value of init_attributes



521
522
523
# File 'lib/rubycc/front/ast.rb', line 521

def init_attributes
  @init_attributes
end

#visibility_attributesObject (readonly)

Returns the value of attribute visibility_attributes

Returns:

  • (Object)

    the current value of visibility_attributes



521
522
523
# File 'lib/rubycc/front/ast.rb', line 521

def visibility_attributes
  @visibility_attributes
end