Initial Commit
This commit is contained in:
789 files changed
+149185
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import std::io;
|
||||
|
||||
# The condition of an `if const` within a pass of `for const` reads the
|
||||
# description the pass is of, as its name, even where only evaluating decides
|
||||
# it, and within a pass of a pass.
|
||||
struct mark : attribute {}
|
||||
@mark struct spinner { var speed: f32; var angle: f32; }
|
||||
@mark struct walker { var pace: f32; }
|
||||
|
||||
def main(): void {
|
||||
for const d in declarations() {
|
||||
if const attached::<mark>(d).length == 0 { continue; }
|
||||
if const d.name == "spinner" {
|
||||
println($"{d.name} spins");
|
||||
} else {
|
||||
println($"{d.name} walks");
|
||||
}
|
||||
if const d.name == "nothing_named_so" {
|
||||
compile_error("No declaration is named so.");
|
||||
}
|
||||
for const m in members_of(d) {
|
||||
if const m.name.length > 4 && d.name != "walker" {
|
||||
println($"{d.name}.{m.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user