Class: Rubycc::Front::AST::Parameter
- Inherits:
-
Data
- Object
- Data
- Rubycc::Front::AST::Parameter
- Defined in:
- lib/rubycc/front/ast.rb
Overview
A single function parameter. name is the identifier String, or nil
for an unnamed parameter in a prototype (e.g. "int f(int, int);").
type is the parameter's Rubycc::Type (int, char or a pointer; never
void, except as a pointer's target). const is true when the parameter
object is top-level const-qualified ("int f(const int x)"), computed
after the array/function-to-pointer adjustment, so the generator can
reject writes to it.
incoming_type is the type the caller hands over when that differs
from the declared one, and nil (the common case) when the two coincide.
Only an old-style (identifier-list) definition can separate them: such a
function has no prototype, so its arguments arrive default-argument
promoted (6.9.1p10 with 6.5.2.2p6) — a float parameter is passed a
double, a char/short/_Bool parameter an int — and the body
still sees the narrow object it declared. #abi_type is what the calling
convention and the function's own type are built from; type is what
the body reads and writes.
Instance Attribute Summary collapse
-
#const ⇒ Object
readonly
Returns the value of attribute const.
-
#incoming_type ⇒ Object
readonly
Returns the value of attribute incoming_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#abi_type ⇒ Object
The type this parameter occupies an ABI slot as.
-
#initialize(name:, type:, token:, const:, incoming_type: nil) ⇒ Parameter
constructor
A new instance of Parameter.
Constructor Details
#initialize(name:, type:, token:, const:, incoming_type: nil) ⇒ Parameter
Returns a new instance of Parameter.
474 475 476 |
# File 'lib/rubycc/front/ast.rb', line 474 def initialize(name:, type:, token:, const:, incoming_type: nil) super end |
Instance Attribute Details
#const ⇒ Object (readonly)
Returns the value of attribute const
473 474 475 |
# File 'lib/rubycc/front/ast.rb', line 473 def const @const end |
#incoming_type ⇒ Object (readonly)
Returns the value of attribute incoming_type
473 474 475 |
# File 'lib/rubycc/front/ast.rb', line 473 def incoming_type @incoming_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name
473 474 475 |
# File 'lib/rubycc/front/ast.rb', line 473 def name @name end |
#token ⇒ Object (readonly)
Returns the value of attribute token
473 474 475 |
# File 'lib/rubycc/front/ast.rb', line 473 def token @token end |
#type ⇒ Object (readonly)
Returns the value of attribute type
473 474 475 |
# File 'lib/rubycc/front/ast.rb', line 473 def type @type end |
Instance Method Details
#abi_type ⇒ Object
The type this parameter occupies an ABI slot as.
479 480 481 |
# File 'lib/rubycc/front/ast.rb', line 479 def abi_type incoming_type || type end |