Units start here, with the part that needs no import graph: what a unit is called and where it must live. The parser only ever read a single identifier after `unit` and `import`, so `unit game.main;` and `import std.io;` were syntax errors -- which is why the dotted fixtures failed at the semicolon. It now reads a dotted path and stores it canonically, dots included, since that spelling is the unit's identity everywhere else. `import a.b as c;` parses too, with the alias on the node. resolve.c is the new pass between parsing and checking, for the questions that span files. It carries SPEC 8.1 so far: each path segment is ASCII lowercase, starts with a letter, continues with letters, digits or underscore, and is at most eight characters; and the dotted path must match the source path it was read from, so game.world.map has to come from game/world/map.fe. The source side is folded to lowercase before comparing, because a case-insensitive host must not let two spellings become two units. That rule then applied to the fixtures, which were not obeying it: 57 declared a unit name unrelated to their file, left over from the milestone directories, and eight had names too long to be legal. Both are now aligned -- the rule is worth having only if the tree follows it. units: badupper, badlong and unitbad pass. 138 -> 146 of 188. The rest of units/ needs the import graph, which is the next piece: resolution, cycles, bindings and visibility.
21 lines
405 B
Plaintext
21 lines
405 B
Plaintext
unit v012form;
|
|
|
|
shared atomic var ticks: u16 = 0;
|
|
packed struct Packet {
|
|
tag: u8,
|
|
value: u16,
|
|
}
|
|
interrupt_safe fn poll() { }
|
|
interrupt fn timer() { }
|
|
fn invoke(p: far fn()) { }
|
|
|
|
pub fn demo() {
|
|
var count = undefined;
|
|
count = 1;
|
|
critical { ticks += 1; }
|
|
let x = true and not false or false;
|
|
let y = x orelse true;
|
|
let e = error.NotFound;
|
|
@call_far(@as_far_fn(timer));
|
|
}
|