rip-lang 3.13.22 → 3.13.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.22",
3
+ "version": "3.13.23",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/components.js CHANGED
@@ -1521,6 +1521,10 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1521
1521
  this._createLines = [];
1522
1522
  this._setupLines = [];
1523
1523
 
1524
+ // Capture enclosing loop variables before pushing current loop
1525
+ const outerLoopParams = this._loopVarStack.map(v => `${v.itemVar}, ${v.indexVar}`).join(', ');
1526
+ const outerExtra = outerLoopParams ? `, ${outerLoopParams}` : '';
1527
+
1524
1528
  this._loopVarStack.push({ itemVar, indexVar });
1525
1529
  const itemNode = this.generateTemplateBlock(body);
1526
1530
  this._loopVarStack.pop();
@@ -1534,7 +1538,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1534
1538
 
1535
1539
  // Generate block factory
1536
1540
  const factoryLines = [];
1537
- factoryLines.push(`function ${blockName}(ctx, ${itemVar}, ${indexVar}) {`);
1541
+ factoryLines.push(`function ${blockName}(ctx, ${itemVar}, ${indexVar}${outerExtra}) {`);
1538
1542
 
1539
1543
  const localVars = new Set();
1540
1544
  for (const line of itemCreateLines) {
@@ -1572,7 +1576,7 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1572
1576
  factoryLines.push(` },`);
1573
1577
 
1574
1578
  // p() - update
1575
- factoryLines.push(` p(ctx, ${itemVar}, ${indexVar}) {`);
1579
+ factoryLines.push(` p(ctx, ${itemVar}, ${indexVar}${outerExtra}) {`);
1576
1580
  if (hasEffects) {
1577
1581
  factoryLines.push(` disposers.forEach(d => d());`);
1578
1582
  factoryLines.push(` disposers = [];`);
@@ -1625,11 +1629,11 @@ export function installComponentSupport(CodeGenerator, Lexer) {
1625
1629
  setupLines.push(` const __key = ${keyExpr};`);
1626
1630
  setupLines.push(` let __block = __map.get(__key);`);
1627
1631
  setupLines.push(` if (!__block) {`);
1628
- setupLines.push(` __block = ${blockName}(this, ${itemVar}, ${indexVar});`);
1632
+ setupLines.push(` __block = ${blockName}(this, ${itemVar}, ${indexVar}${outerExtra});`);
1629
1633
  setupLines.push(` __block.c();`);
1630
1634
  setupLines.push(` }`);
1631
1635
  setupLines.push(` __block.m(__parent, __anchor);`);
1632
- setupLines.push(` __block.p(this, ${itemVar}, ${indexVar});`);
1636
+ setupLines.push(` __block.p(this, ${itemVar}, ${indexVar}${outerExtra});`);
1633
1637
  setupLines.push(` __newMap.set(__key, __block);`);
1634
1638
  setupLines.push(` }`);
1635
1639
  setupLines.push(``);