Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .claude/skills/testing-hashql/references/mir-builder-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ let body = body!(interner, env; [graph::read::filter]@0/2 -> Bool {
| `x = tuple <a>, <b>;` | Create tuple | `Assign(x, Aggregate(Tuple, [a, b]))` |
| `x = struct a: <v1>, b: <v2>;` | Create struct | `Assign(x, Aggregate(Struct, [v1, v2]))` |
| `x = closure <def> <env>;` | Create closure | `Assign(x, Aggregate(Closure, [def, env]))` |
| `x = opaque (<name>), <value>;` | Create opaque wrapper | `Assign(x, Aggregate(Opaque(name), [value]))` |
| `x = bin.<op> <lhs> <rhs>;` | Binary operation | `Assign(x, Binary(lhs, op, rhs))` |
| `x = un.<op> <operand>;` | Unary operation | `Assign(x, Unary(op, operand))` |
| `x = input.load! "name";` | Load required input | `Assign(x, Input(Load { required: true }, "name"))` |
Expand Down Expand Up @@ -276,6 +277,27 @@ let body = body!(interner, env; [graph::read::filter]@0/2 -> Bool {
});
```

### Opaque Construction and Projection

Construct opaque-wrapped values with `opaque (<name>), <value>`. The name must
be wrapped in parentheses because it is a multi-token path.

```rust
use hashql_core::symbol::sym;

let body = body!(interner, env; fn@0/0 -> Int {
decl inner: (x: Int, y: Int), wrapped: [Opaque sym::path::Entity; ?], result: Int;
@proj y_field = wrapped.y: Int;

bb0() {
inner = struct x: 100, y: 200;
wrapped = opaque (sym::path::Entity), inner;
result = load y_field;
return result;
}
});
```

### Direct Function Calls

Use a `DefId` variable directly:
Expand Down
Loading
Loading