Skip to content

Preserve class helpers, template captures and pure export metadata - #3

Draft
yeargun wants to merge 4 commits into
fix/inherited-field-analysisfrom
fix/motion-structural-codegen
Draft

Preserve class helpers, template captures and pure export metadata#3
yeargun wants to merge 4 commits into
fix/inherited-field-analysisfrom
fix/motion-structural-codegen

Conversation

@yeargun

@yeargun yeargun commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Native public classes could strand private helpers inside a wrapper that the class emitter never creates. Large generated modules could also fail export validation when an earlier initializer called a function named of. Release those helpers into an emitted scope and distinguish initializer expressions from for…of declarations. Rejected export output is now available through the existing diagnostic dump option.

Add opt-in javascript.emit_pure_annotations metadata for calls bound to checked pure exports, preserving effectful arguments and excluding shadowed bindings. Motion can expose shared native controls and let downstream bundlers remove unused pure initialization without adding type validation at runtime.

A second optimizer defect missed callback uses and captured stores inside template substitutions. Preserve those bindings in both token-based rewrites and the tree binding census. Copy propagation also retains assignments still read by nested closures. Regression tests cover shadowed template bindings and execute the original and rewritten JavaScript.

Validation: 1,635 compiler library tests pass, including native-constructor execution, annotation erasure, explicit type tests, export validation and purity-binding regressions. Motion's measured level-0 candidate passes 39 browser comparisons and 21 Node/package tests. Level 13 also passes all 39 browser checks after the fixes, but fails the narrow mini consumer size gate (24,306 raw bytes versus a 20,000-byte limit), so it is not selected for publication. This PR is based on the inherited-field fix in #2; broader release checks retain the baseline's existing failures.

@yeargun yeargun changed the title Preserve native class helpers and checked pure export metadata Preserve class helpers, template captures and pure export metadata Sep 11, 2026
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