Skip to content

transpile: replace --reorganize-definitions/--disable-refactoring with --emit-refactor-annotations/--refactor#1640

Open
kkysen wants to merge 1 commit intomasterfrom
kkysen/transpile-refactor-arg
Open

transpile: replace --reorganize-definitions/--disable-refactoring with --emit-refactor-annotations/--refactor#1640
kkysen wants to merge 1 commit intomasterfrom
kkysen/transpile-refactor-arg

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Mar 5, 2026

Previously, --reorganize-definitions would emit annotations and run the refactor, with --disable-refactoring needed to only emit annotations. This simplifies things to additive flags.
--emit-refactor-annotations only emits the annotations. --refactor implies --emit-refactor-annotations and runs the default refactor transforms.

… with `--emit-refactor-annotations`/`--refactor`

Previously, `--reorganize-definitions` would emit annotations and run the refactor,
with `--disable-refactoring` needed to only emit annotations.
This simplifies things to additive flags.
`--emit-refactor-annotations` only emits the annotations.
`--refactor` implies `--emit-refactor-annotations` and runs the default refactor transforms.
@kkysen kkysen requested a review from ahomescu March 5, 2026 07:42
let json = json!({
"lib_rs_file": file_name,
"reorganize_definitions": tcfg.reorganize_definitions,
"reorganize_definitions": tcfg.emit_refactor_annotations,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahomescu, is this the correct change here? I'm not familiar with how cross-checks are supposed to work.

Copy link
Contributor

@fw-immunant fw-immunant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--reorganize-definitions does not just enable annotations, it also changes the structure of the emitted code to include modules and cross-module imports (see generate_submodule_imports and the block labelled "Header Reorganization: Submodule Item Stores" in translator/mod.rs, which only has an effect when individual files' definition sets are tracked, a side effect of the reorganize_definitions bool). So while we should probably clarify the name, the new name shouldn't suggest that the flag is merely additive.

We could maybe split a separate boolean out to control the transpiler's submodule/header behavior, or use a name that clarifies that this is tied together with the reorganize-definitions annotations.

Copy link
Contributor Author

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--reorganize-definitions does not just enable annotations, it also changes the structure of the emitted code to include modules and cross-module imports (see generate_submodule_imports and the block labelled "Header Reorganization: Submodule Item Stores" in translator/mod.rs, which only has an effect when individual files' definition sets are tracked, a side effect of the reorganize_definitions bool). So while we should probably clarify the name, the new name shouldn't suggest that the flag is merely additive.

Ahh. Why isn't this done always, then? I thought the reorganize_definitions transform is the one that replace duplicate definitions with cross-module imports.

We could maybe split a separate boolean out to control the transpiler's submodule/header behavior, or use a name that clarifies that this is tied together with the reorganize-definitions annotations.

What's a good name for this?

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.

2 participants