Decorators
The declaration forms and annotations AnimaScript understands — unknown decorators are ignored rather than rejected.
| Decorator | Meaning |
|---|---|
struct | plain-old-data type with flattened representation — see Structs & Refs |
FixedArray<T, N> | fixed-size value elements embedded flat in a field’s owner — see Value Arrays |
@inline | guaranteed inlining in optimized
builds regardless of size (recursion excluded); in every build, a call that
leaves out constant i32 defaults deciding an if,
or passes integer literals for them, reaches a copy with those
ifs folded, so code only other values reach is left out of the module,
and the build does not type check it until some call reaches it. Any
other argument keeps every branch. An optimized build’s binaryen pass
also inlines the calls rasc leaves |
@noinline | never inlined in optimized builds, neither by rasc nor by an optimized build’s binaryen pass, which otherwise inlines every function that has only one caller. Use it to keep a function out of line, for example a loop that should not be merged into a caller that makes calls |
@unchecked | the class or function is unchecked code: a release build drops its index checks, downcasts and null traps, and its float to integer casts saturate; debug and optimized builds keep every check |
@unmanaged | raw struct: no GC header and no runtime class id; works
with changetype and pointer arithmetic. new takes
memory no frame boundary reclaims, until __free releases it,
so W3006 flags one a function
makes without storing, returning or freeing it. Nothing traces its
fields, so new of one holding a string, closure or managed
reference is an error. Without a class id it
has nothing to dispatch on, so it cannot extend or be extended by a
managed class, implement an interface, or override a method |
operator members | operator overloads are C++-style
members on classes and structs alike — operator[](i),
operator[]=(i, v), unchecked operator[] (the
unchecked() fast path), operator==,
static operator+(l, r). AnimaScript has no @operator decorator — operators are ordinary
members; see Methods &
Constructors |
@editTime | the declaration exists only in edit
time builds, which the editor and rive --test make; a runtime
build drops it before anything
registers, and runtime code that names it is an error (E3002). Valid on a
class, a function, or the whole module as a bare @editTime;
at file level; the bare form inside a namespace block marks that block
alone, not other blocks of the same namespace. A class extending an edit
time class is edit time too.
Rive’s test harness (rive/test, the Tests
base) is declared this way, so suites never ship in a
.riv |
Unknown decorators are ignored rather than rejected.