RakuAST::Doc::Declarator Reference
Contains the declarator docs of a RakuAST object
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method new #
The new method can be called to create a new RakuAST::Doc::Declarator object. It only takes named arguments. Note that the leading and trailing documentation may contain any left margin whitespace. The RakuAST object for which this declarator contains the documentation. A Positional with the lines of leading documentation strings. A Positional with the lines of trailing documentation strings.
method set-WHEREFORE #
Set the object for which the RakuAST::Doc::Declarator object contains the documentation.
method set-leading #
Set the leading documentation. If no arguments are specified, reset to not having any leading documentation.
method add-leading #
Add a line to the leading documentation.
method set-trailing #
Set the trailing documentation. If no arguments are specified, reset to not having any trailing documentation.
method add-trailing #
Add a line to the trailing documentation.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
13 no-output
class RakuAST::Doc::Declarator { }Not executed: the documentation states no expected output for this example.
use experimental :rakuast;
Not executed: the documentation states no expected output for this example.
say "attached to a $declarator.WHEREFORE.^name() object";
Not executed: the documentation states no expected output for this example.
.say for $declarator.leading;
Not executed: the documentation states no expected output for this example.
.say for $declarator.trailing;
Not executed: the documentation states no expected output for this example.
# method .gist falls back to .raku say $declarator; # RakuAST::Doc::Declarator.new(...
Not executed: the documentation states no expected output for this example.
method new(
Str:D :$WHEREFORE, # the associated RakuAST object
:@leading, # leading lines of documentation
:@trailing # trailing lines of documentation
)Not executed: the documentation states no expected output for this example.
# there is no syntax for creating just a ::Declarator object
my $declarator = RakuAST::Doc::Declarator.new(
:WHEREFORE(RakuAST::VarDeclaration::Simple.new(...)),
:leading("line 1 leading","line 2 leading"),
:trailing("line 1 trailing","line 2 trailing")
);Not executed: the documentation states no expected output for this example.
$declarator.set-WHEREFORE($object);
Not executed: the documentation states no expected output for this example.
$declarator.set-leading; # reset
$declarator.set-leading("foo", "bar");Not executed: the documentation states no expected output for this example.
$declarator.add-leading("additional");Not executed: the documentation states no expected output for this example.
$declarator.set-trailing; # reset
$declarator.set-trailing("foo", "bar");Not executed: the documentation states no expected output for this example.
$declarator.add-trailing("additional");Not executed: the documentation states no expected output for this example.