Class: Rubycc::Front::AST::CompoundLiteral
- Inherits:
-
Data
- Object
- Data
- Rubycc::Front::AST::CompoundLiteral
- Defined in:
- lib/rubycc/front/ast.rb
Overview
A compound literal "( type-name ) { initializer-list }" (ISO C 6.5.2.5).
type is the resolved Rubycc::Type of the unnamed object the literal
denotes, with any inferred "[]" array bound already completed by the
parser (so "(int)1,2,3" carries int); initializer is the
AST::InitializerList that fills it. In block scope the object has
automatic storage lasting the enclosing block, so the literal is an
lvalue: the generator lays it out on a stack object, initializes it, and
yields the object's value the same way a variable of type would (a
struct/union as its base address, an array decayed to an element pointer,
a scalar as a load) — which is what lets "&(T)...", "(T)....member",
a by-value argument and an assignment right-hand side all work. A
compound literal in a static-storage-duration (file-scope) initializer is
diagnosed as unsupported by the generator. token is the opening "(".
Instance Attribute Summary collapse
-
#initializer ⇒ Object
readonly
Returns the value of attribute initializer.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Attribute Details
#initializer ⇒ Object (readonly)
Returns the value of attribute initializer
177 178 179 |
# File 'lib/rubycc/front/ast.rb', line 177 def initializer @initializer end |
#token ⇒ Object (readonly)
Returns the value of attribute token
177 178 179 |
# File 'lib/rubycc/front/ast.rb', line 177 def token @token end |
#type ⇒ Object (readonly)
Returns the value of attribute type
177 178 179 |
# File 'lib/rubycc/front/ast.rb', line 177 def type @type end |