class

Bindgen::Parser::Argument

Inherits JSON::Serializable < Bindgen::Parser::Type < JSON::Serializable < Reference < Object

Describes a method argument.

Constants

STD_FUNCTION = "std::function"

The name of a std::function class template.

Constructors

new(name : String, base_name, full_name, const, reference, move, builtin, void, pointer, template, kind = Type::Kind::Class, has_default : Bool = false, value : Bool | Float64 | Int64 | String | UInt64 | Nil = nil, nilable = false, variadic : Bool = false, extents = Array(UInt64).new, array_pointer = 0, desugared = nil, never_nil = false, typedefs = nil)
Source
new(name : String, type : Type, has_default : Bool = false, value : Bool | Float64 | Int64 | String | UInt64 | Nil = nil)
Source
new(pull : JSON::PullParser)

Describes a method argument.

Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

after_initialize

A std::function<R (Args...)> argument becomes a Kind::Function type like Type.proc builds: a Proc or block in Crystal, a CrystalProc in the binding, which the C++ glue wraps into the std::function. See Type#std_function? and SPEC.md ยง2.2.6.

Source
defaults_to_nil?

If this is a pointer-type, does it default to nullptr in C++?

Source
has_default?

Does this argument have a default value?

Source
has_exposed_default?

Does this argument have an exposed default value?

Source
hash(hasher)

See Object#hash(hasher)

merge(other : Argument)

Merges this argument with other. Only merges the name, defaultness, its value and nil-ability. For the value, this argument takes precedence over other. The name is taken from other, as Crystal expects the arguments of an overriding method to be named like those of the overridden one. Unnamed arguments are named by their position.

Source
name

Name of this argument.

Source
named(name : String) : Argument

Returns a copy of this argument named name.

Source
nilable?

Assume that if the argument defaults to nullptr, that it is nilable.

Source
substitute_type(name : String, with type : Type) : Argument

Substitutes all uses of name on the type part of this argument with the given type.

Source
substitute_type(replacements : Hash(String, Type)) : Argument

Performs type substitution on the type part of this argument using the given replacements.

Source
type_equals?(other : Type)

Checks if the type-part of this equals the type-part of other.

Source
value

Default value for this argument, if an initializer literal is found.

Source
variadic?

Is this the vararg (...) argument?

Source
without_default

Returns a copy of this argument without a default value.

Source