Standard Library · meta
class Param
One parameter of a method, as a rule sees it.
since 0.1.0-alpha.1linuxwindowswasm
Examples
attribute Inspect { }
rule inspect {
match @Inspect(i) on class C
inject `Array<string> params() => [ $for s in C.methods.map((m) => m.name + "(" +
m.params.map((p) => p.type + " " + p.name).joinToString(", ") + ")") : $s ];` at member of C
}
@Inspect
class Calc {
int add(int a, int b) => a + b;
string repeat(string text, int times) => text;
void reset() { }
}
console.writeln(Calc().params().joinToString("; "));
add(int a, int b); repeat(string text, int times); reset()
Fields
name
string nameThe parameter's name.
type
string typeThe parameter's type, spelled as the source wrote it.
See also
- Method — A method of a class, as a rule sees it.