Commit ae0fea2
committed
refactor(compile): mass split lower_call + compile.rs (v0.5.340)
Four extractions in one PR. Completes the lower_call.rs split (the
last v0.5.339 deferred item) and four big chunks of compile.rs.
lower_call/native.rs (805 LOC) — `lower_native_method_call` for native
module dispatch (mysql2, pg, redis, mongo, ws, fastify, fetch,
perry/ui, perry/system, perry/i18n, perry/plugin, AbortController).
Required bumping 14 helpers to `pub(super)`.
compile/targets.rs (~800 LOC) — 6 `compile_for_*` widget/web/wasm
orchestrators plus their Apple/Android helpers (find_watchos_swift_runtime,
find_visionos_swift_runtime, apple_sdk_version, lookup_bundle_id_from_toml,
compile_metallib_for_bundle, generate_js_bundle).
compile/object_cache.rs (~440 LOC) — V2.2 codegen cache: djb2_hash +
Djb2Hasher + compute_object_cache_key (246 LOC) + ObjectCache struct
+ impl + 282-LOC test mod.
compile/resolve.rs (~810 LOC) — TS/JS module resolution: resolve_import
family + npm package classification + file: deps (#209) +
find_perry_workspace_root + file-extension predicates.
Cumulative across this commit:
- compile.rs: 8057 → 5795 LOC (-2262, -28%)
- lower_call.rs: 5085 → 4681 LOC (-404, -8%)
Cumulative across the entire session (v0.5.329 → v0.5.340):
- compile.rs: 9391 → 5795 (-38%)
- lower_call.rs: 7000+ → 4681 (-33%)
- lower.rs: 13591 → 7554 (-44%)
- lower::lower_expr: 6687 → 624 (-91%)
What's still inline in compile.rs (5795 LOC): the orchestrator entry
points, context construction, build_optimized_libs (~270 LOC),
build_link_command (the bulk). Each independently extractable; doing
more would shift this PR into rewrite-territory.
Verified:
- cargo build --release clean
- cargo test --workspace 434/0 = baseline
- gap tests 25/28; doc-tests 80/82 = baseline
- UI smoke (App + Button + Text) compiles to 0.9 MB binary, exits 0
in PERRY_UI_TEST_MODE; strip-dedup output matches v0.5.331 exactly
(419 → 35 trimmed objects) — proves the live path through
library_search + targets + strip_dedup + ObjectCache + resolve all
works.
- Multi-module #212 closure-capture smoke matches Node byte-for-byte.1 parent 69f2584 commit ae0fea2
9 files changed
Lines changed: 3506 additions & 3356 deletions
File tree
- crates
- perry-codegen/src
- lower_call
- perry/src/commands
- compile
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
0 commit comments