- Task 1: OCaml/dune scaffold with woc CLI (exit codes 0/1/2), just woc-build/woc-test - Task 2: Diagnostics module — WO-E coded diagnostics with excerpts, related sites, ordered dedup collector, exit-code decision - Task 3: Newline-significant lexer mirroring rt conventions (self/me/subscribe/insert stay idents), --dump-tokens, golden test framework with bless mode - Task 4: Declaration parser — class/type/interface/fn signatures, @gc/@table annotations, brace-depth skip-on-block (service/policy/on), decl-level recovery, --dump-ast goldens - 13 golden fixtures (tokens + AST) with WOC_BLESS=1 support - just woc-test green (14 diag + 93 runner checks)
43 lines
672 B
Text
43 lines
672 B
Text
interface Priced {
|
|
fn current_price() -> Money
|
|
}
|
|
|
|
@table(name: "products", index: [sku])
|
|
class Product {
|
|
id: Id
|
|
sku: SKU @unique
|
|
name: Text
|
|
prices: multi Price
|
|
owner: ref Customer
|
|
|
|
fn current_price() -> Money {
|
|
return latest(self.prices).amount;
|
|
}
|
|
|
|
fn rename(name: Text) {
|
|
self.name = name;
|
|
}
|
|
|
|
fn set_price(mut amount: Money) {
|
|
self.prices = amount;
|
|
}
|
|
|
|
fn adopt(take other: Product) -> Product {
|
|
return other;
|
|
}
|
|
}
|
|
|
|
@gc
|
|
class PriceCache {
|
|
entries: map<SKU, Money>
|
|
}
|
|
|
|
type Note {
|
|
id: Id
|
|
body: Text
|
|
created: Timestamp = now()
|
|
}
|
|
|
|
fn discount(mut amount: Money, take pct: Int) -> Money {
|
|
return amount;
|
|
}
|