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)
SourceDescribes a method argument.
SourceInstance 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.
Sourcedefaults_to_nil?
If this is a pointer-type, does it default to nullptr in C++?
Sourcehas_default?
Does this argument have a default value?
Sourcehas_exposed_default?
Does this argument have an exposed default value?
Sourcemerge(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.
Sourcenamed(name :
String) :
Argument Returns a copy of this argument named name.
Sourcenilable?
Assume that if the argument defaults to nullptr, that it is nilable.
Sourcesubstitute_type(name :
String, with type :
Type) :
Argument Substitutes all uses of name on the type part of this argument with
the given type.
Sourcesubstitute_type(replacements :
Hash(
String,
Type)) :
Argument Performs type substitution on the type part of this argument using the
given replacements.
Sourcetype_equals?(other : Type)
Checks if the type-part of this equals the type-part of other.
Sourcevalue
Default value for this argument, if an initializer literal is found.
Sourcevariadic?
Is this the vararg (...) argument?
Sourcewithout_default
Returns a copy of this argument without a default value.
Source