Skip to content
Merged
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
1 change: 1 addition & 0 deletions quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ generic std gap is planned here even when moq never calls it.
- [Python's wake on the loop's own thread](/quest/m3/ffi-python-wake.md) - a wake on the event loop's thread resumes the future with no socket pair
- [Python's call cost](/quest/m3/ffi-python-calls.md) - a call on an object costs what BoltFFI's does, or the gap is explained
- [A std map with a crate's own BuildHasher](/quest/m3/ts-map-own-hasher.md) - std's and hashbrown's maps built with a crate's own hasher translate for keys that are JS objects
- [A name or an operator argument at its own Rust span](/quest/m3/ts-argument-spans.md) - a `tsc` error on a plain-name or operator argument names that argument's Rust, not the method it is passed to
22 changes: 22 additions & 0 deletions quest/m3/ts-argument-spans.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# [S] A name or an operator argument at its own Rust span

## Goal

When `tsc` rejects an argument of a translated call that is a plain name or an operator,
[rust2-ts](/ts/README.md) reports the error at that argument's Rust, not at the method name of
the call it is passed to, proven by the `spans` fixture's snapshot.

## Plan

Left out of [#520](https://github.com/moq-dev/rust2/pull/520), which maps an argument made by
a call to its own Rust. In `Meter.scaled(m, rt.u32WrappingAdd(a, 1), ...)`, the receiver `m`
still maps to `scaled`, as does an argument such as `(a ^ b) >>> 0`.

MIR gives each argument its own span (`Spanned<Operand>`). Locating names and operators the
way calls are located needs the lowering passes that match on expression shapes, such as
`Expr::Ident`, `Expr::Member`, or `Expr::Binary`, to look through the location wrapper first.
Wrapping members and binaries naively changed what the formatting code spills into a variable
before its closure reads it, so the generated code changed. Prove the output text unchanged by
the snapshots, as #520 did, and measure the source map's growth on moq's translation.

Public API: the translator's error spans.