[pull] master from GaijinEntertainment:master#1025
Merged
Conversation
…ablePeeling
`$e(...)` in `qmacro`/`qmacro_block`/`qmacro_expr`/`qmacro_block_to_array`
now substitutes peel-aware in BOTH bare-var and ExprRef2Value-wrapped
contexts via a single rule table (`var2expr`). The split between
`replaceVariable` (non-peel) and `replaceVariablePeeling` (wrapped-only)
collapses to a single route:
* `var2exprPeeling` field → DELETED
* `replaceVariablePeeling` function → DELETED
* `TemplateVisitor.visitExprVar`: substitutes from `var2expr`, gated by
`in_r2v_wrapper == 0` so the wrapper visit takes precedence when
present
* `TemplateVisitor.visitExprRef2Value`: now consults `var2expr` (was
`var2exprPeeling`) — wrapped form strips the wrapper as part of
substitution
`in_r2v_wrapper` is a depth counter incremented in `preVisitExprRef2Value`,
decremented in the post-visit. Symmetric, handles nesting.
Sole caller of `replaceVariablePeeling` (ast_match.das:2263 in
`peel_lambda_replace_var`) migrated to `replaceVariable`; docstring updated
to reflect the unified peel semantics.
Aligns qmacro substitution with qmatch's "post-infer AST always wants
peeling" convention — pre-infer call sites (no wrapper) and post-infer
call sites (typer-inserted wrapper) both work through the same name
without per-site decision.
Validation: 5287 tests green across tests/template, tests/ast_match,
tests/linq, tests/decs, tests/dasSQLITE, tests/macro_call,
tests/macro_boost, tests/language, tests/gc, tests/daslib, tests/lint,
tests/json, tests/dasPUGIXML, tests/strings, utils/lint/tests.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot review on PR #2817 caught a real bug: the original ``in_r2v_wrapper`` gate suppressed visitExprVar substitutions under ANY ExprRef2Value, but visitExprRef2Value's peel-and-substitute only fires when ``subexpr is ExprVar``. So nested shapes like ``ExprRef2Value(ExprField(ExprVar(temp), "f"))`` lost the substitution on the inner var (the wrapper sat over a field access, not directly the var, so the peel didn't fire — and the bare-var rule was gated off). Fix: only increment the depth counter when the wrapper's direct subexpr IS an ExprVar. The post-visit decrement matches the same condition. Renamed counter to ``in_r2v_direct_var`` for clarity. The narrow gate preserves the original "wrapper visit takes precedence" semantics for the peelable shape while letting visitExprVar substitute normally for all other shapes. Adds tests/template/test_apply_template_peel.das with 4 regression cases covering the unified peel substitution surface: 1. Bare ExprVar — substitutes via visitExprVar 2. R2V(ExprVar) — wrapper stripped, substitutes via visitExprRef2Value 3. R2V(ExprField(ExprVar)) — substitutes inside, wrapper preserved 4. R2V(ExprVar) with no matching rule — passes through unchanged Verified: case 3 fails on the pre-fix gate (incorrectly suppresses the substitution); passes after the fix. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…lane `qmacro(REPLACEMENT)` expands to `ExprQuote(REPLACEMENT)` which the LLVM JIT does not lower (pre-existing regression on master — see feedback_master_jit_quote_regression). Construct the replacement var directly via `new ExprVar(at = LineInfo(), name := "REPLACEMENT")` to keep all 4 regression tests passing across interp, AOT, and JIT lanes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…el-by-default templates_boost: unify $e splice on peel-by-default; drop replaceVariablePeeling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )