writeonce/compiler/test/golden/ast/pricing-demo.expected
shoney.arickathil f57844110d feat(compiler): Tasks 1-4 — scaffold, diagnostics, lexer, declaration parser
- 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)
2026-08-10 09:00:08 +02:00

24 lines
801 B
Text

1:1 INTERFACE Priced
2:3 METHOD current_price() -> Money
6:1 CLASS Product @table(name="products", index=[sku])
7:3 FIELD id: Id
8:3 FIELD sku: SKU @unique
9:3 FIELD name: Text
10:3 FIELD prices: multi Price
11:3 FIELD owner: ref Customer
13:3 METHOD current_price() -> Money
14:5 RETURN latest(self.prices).amount
17:3 METHOD rename(name: Text)
18:5 ASSIGN self.name = name
21:3 METHOD set_price(mut amount: Money)
22:5 ASSIGN self.prices = amount
25:3 METHOD adopt(take other: Product) -> Product
26:5 RETURN other
31:1 CLASS PriceCache @gc
32:3 FIELD entries: map<SKU, Money>
35:1 TYPE Note
36:3 FIELD id: Id
37:3 FIELD body: Text
38:3 FIELD created: Timestamp = now()
41:1 METHOD discount(mut amount: Money, take pct: Int) -> Money
42:3 RETURN amount