Class: Chelsy::Type::Array
- Defined in:
- lib/chelsy/ast.rb
Overview
From: 6.7.5.3 Function declarators (including prototypes)
qualifier in parameter array declarator
A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation.
static
in parameter array declarator
If the keyword static also appears within the [ and ] of the array type derivation, then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression.
Instance Attribute Summary collapse
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Element
Instance Method Summary collapse
-
#incomplete? ⇒ Boolean
An array type of unknown size is an incomplete type.
-
#initialize(element_type, size = nil, static: false, **rest) ⇒ Array
constructor
A new instance of Array.
- #static? ⇒ Boolean
- #variable? ⇒ Boolean
Methods inherited from Base
#const?, #qualified?, #volatile?
Constructor Details
#initialize(element_type, size = nil, static: false, **rest) ⇒ Array
Returns a new instance of Array.
416 417 418 419 420 421 422 |
# File 'lib/chelsy/ast.rb', line 416 def initialize(element_type, size = nil, static: false, **rest) @element_type = element_type @size = size && Syntax::ArraySize.ensure(size) @static = !!static super(**rest) end |
Instance Attribute Details
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
414 415 416 |
# File 'lib/chelsy/ast.rb', line 414 def element_type @element_type end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
414 415 416 |
# File 'lib/chelsy/ast.rb', line 414 def size @size end |
Instance Method Details
#incomplete? ⇒ Boolean
An array type of unknown size is an incomplete type.
425 |
# File 'lib/chelsy/ast.rb', line 425 def incomplete?; @size.nil? end |
#static? ⇒ Boolean
428 |
# File 'lib/chelsy/ast.rb', line 428 def static?; @static end |
#variable? ⇒ Boolean
426 |
# File 'lib/chelsy/ast.rb', line 426 def variable?; @size == :* end |