Skip to content

Report a program's args from inside quietly { } in sight parse --json - #379

Merged
jbearak merged 1 commit into
mainfrom
program-args-brace-blocks
Nov 5, 2026
Merged

jbearak merged 1 commit into
mainfrom
program-args-brace-blocks

Conversation

@jbearak

@jbearak jbearak commented Nov 5, 2026

Copy link
Copy Markdown
Owner

sight parse --json gave "args": [] for a program whose args is inside a brace block, which is common in real code:

program p
    quietly {
        args first second
    }
end

Stata 18 defines first and second here, and the analyzer already did (since #376). Only program.args in the JSON missed them, because it read top-level args statements only.

Now program.args follows the same rule #378 gave the syntax signature. It takes the top-level args statements, or, when the program has exactly one args and it is inside brace blocks (quietly {, capture {, nested) or a frame name { block, that one. With several and any of them nested (one per if/else branch, say), it keeps the top-level ones, as before. The two rules share one helper in src/utils/node-body.ts.

sight parse --json change

In statements[] of kind program, args (a list of {"name", "range"}) is filled for a program whose only args is inside brace or frame blocks. The example above gives first and second with the ranges of their names, where it gave [] before. Programs with top-level args, or with several args and any nested, are unchanged. Nothing else in the output changes. The golden fixture brace-blocks.do gains a quiet_args program that shows it.

Not changed

The editor has no args-based program metadata. ProgramSymbol.parameters is declared but never set or read, and hover shows only the syntax signature, so only the JSON changes.

Proof: StataMP 18 on voyager defines the args locals in quietly {, nested capture noisily { quietly { } }, and frame default {. sight check gives no undefined macro for them. The new parse-graph-json.test.ts case fails on main. All four gates pass.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code (Claude Code harness), reviewed by gpt-6.1-sol in Codex.

…rse --json

`program.args` read only top-level `args` statements, so
`quietly { args a b }` gave `[]`. It now uses the same rule as the
signature: the top-level `args`, or the program's only `args` when it is
inside brace or `frame` blocks. Several with any nested keep the
top-level ones. Both rules share one helper.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available. Your 54 included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: b8ccedca-a421-40a8-8fb0-cfc85e528e67
Commits

Reviewing files that changed from the base of the PR and between df6ca65 and b8b9a8e.

Files selected for processing: 6

  • docs/cli.md
  • src/cli/parse-json.ts
  • src/utils/node-body.ts
  • tests/fixtures/cli-json/expected/parse.json
  • tests/fixtures/cli-json/project/brace-blocks.do
  • tests/unit/cli/parse-graph-json.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak merged commit a160fe6 into main Nov 5, 2026
16 checks passed
@jbearak
jbearak deleted the program-args-brace-blocks branch November 5, 2026 04:52
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.

1 participant