Represent %todo with a Pexp_todo parsetree node
Why
%todo is a language feature selected by an extension name, one of the items #8624 lists before the parsetree can be stamped as v1. The node holds the message as written; PPXs still see the extension.
modifiedAST %todo
let f = () => %todo("later")parse
Before
After
expressionexpression└─ Pexp_extension "todo" └─ structure_item ├─ Pstr_eval └─ expression └─ Pexp_constant PConst_string (source="later", semantic="later")├─ Pexp_todo└─ Some └─ expression └─ Pexp_constant PConst_string (source="later", semantic="later")
Review
- Which payloads become a node? None, a string literal, or a template without interpolations, without attributes. Any other payload, such as
%todo(1), stays an extension and is lowered as before, ignoring it. - Why an expression for the message rather than a string? It keeps the spelling (quotes or backquotes, escapes) and the comments inside the payload for the printer, as the extension did.