Class: Rubycc::Front::AST::GlobalDecl

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

Overview

A file-scope (global) variable declaration. type is the declared Rubycc::Type (int, char, a pointer, a one-dimensional array or a struct/union). At most one of two initializer fields is set: initializer_value is a plain scalar-integer initializer folded to a Ruby Integer on the spot (the common "int g = 1 + 2;" case, kept folded so nothing downstream re-evaluates it), while initializer_node carries a still-unfolded initializer the generator lowers itself — a brace initializer-list (AST::InitializerList) for an aggregate or scalar, a string literal for a char array, or an address constant for a pointer (a null pointer, "&other_global", a decayed global array name or a string literal). Both are nil for an uninitialized global, which lands in .bss. const and storage carry the same top-level const flag and storage-class specifier (nil/:static/:extern) as VariableDecl; the generator diagnoses writes against a const global but does not yet act on the storage class (Phase B). alignas carries the same _Alignas boundary VariableDecl does.

Instance Attribute Summary collapse

Instance Attribute Details

#alignasObject (readonly)

Returns the value of attribute alignas

Returns:

  • (Object)

    the current value of alignas



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def alignas
  @alignas
end

#constObject (readonly)

Returns the value of attribute const

Returns:

  • (Object)

    the current value of const



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def const
  @const
end

#initializer_nodeObject (readonly)

Returns the value of attribute initializer_node

Returns:

  • (Object)

    the current value of initializer_node



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def initializer_node
  @initializer_node
end

#initializer_valueObject (readonly)

Returns the value of attribute initializer_value

Returns:

  • (Object)

    the current value of initializer_value



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def initializer_value
  @initializer_value
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def name
  @name
end

#storageObject (readonly)

Returns the value of attribute storage

Returns:

  • (Object)

    the current value of storage



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def storage
  @storage
end

#tokenObject (readonly)

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def token
  @token
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



98
99
100
# File 'lib/rubycc/front/ast.rb', line 98

def type
  @type
end