Skip to content

feat: allow expressions in add-to-list statements#362

Open
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/add-expression-to-list
Open

feat: allow expressions in add-to-list statements#362
hjotha wants to merge 1 commit intomendixlabs:mainfrom
hjotha:submit/add-expression-to-list

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 27, 2026

Summary

Allows microflow add-to-list statements to preserve expression-valued add items.

Changes

  • Extends the grammar from add $Item to $List to add expression to $List.
  • Stores the parsed expression on AddToListStmt while preserving the legacy simple-variable Item field.
  • Writes the expression value into ChangeListAction.Value during rebuild.
  • Adds proposal docs, a doctype fixture, quick-reference entry, and skill guidance for the new syntax.

Validation

  • go test ./mdl/visitor -run TestAddToList
  • go test ./mdl/executor -run TestAddToListBuilder
  • ./bin/mxcli check mdl-examples/doctype-tests/add_expression_to_list.test.mdl
  • make build
  • make lint-go
  • make test

Closes #361
Part of #352
Part of #332

Studio Pro stores list-add values as expression strings, but MDL only accepted `add $Item to $List` and the AST kept only a bare item variable. Round-tripping a list-add action whose value is an attribute path or function call could therefore lose the original expression shape.

The grammar now accepts `add expression to $List`, the visitor stores the parsed expression while keeping the simple-variable compatibility field, and the builder writes the expression value back to the `ChangeListAction`. The existing variable-only form remains supported.

Tests cover parser and builder behavior for expression and simple-variable forms. The branch also adds a draft proposal, doctype fixture, quick-reference entry, and skill guidance; `mxcli check` on the fixture plus make build, make lint-go, and make test pass locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow expressions in add-to-list microflow statements

2 participants