From f4c79395bece7fa57c6c4939e95fba6153398f18 Mon Sep 17 00:00:00 2001 From: Rithik Seth <106665190+Heulitig@users.noreply.github.com> Date: Mon, 6 Nov 2023 19:59:16 +0530 Subject: [PATCH] fixed loop counter resolving issue (#1454) --- ftd/src/js/resolver.rs | 8 ++++---- ftd/t/js/27-for-loop.html | 6 +++--- ftd/t/js/32-ftd-len.html | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ftd/src/js/resolver.rs b/ftd/src/js/resolver.rs index c402c8fad7..d2ba624d59 100644 --- a/ftd/src/js/resolver.rs +++ b/ftd/src/js/resolver.rs @@ -38,7 +38,7 @@ impl<'a> ResolverData<'a> { loop_counter_alias: self.loop_counter_alias, inherited_variable_name: fastn_js::INHERITED_VARIABLE, device: self.device, - doc_name: None, + doc_name: self.doc_name.clone(), } } @@ -53,7 +53,7 @@ impl<'a> ResolverData<'a> { loop_counter_alias: self.loop_counter_alias, inherited_variable_name, device: self.device, - doc_name: None, + doc_name: self.doc_name.clone(), } } @@ -68,7 +68,7 @@ impl<'a> ResolverData<'a> { loop_counter_alias: self.loop_counter_alias, inherited_variable_name: self.inherited_variable_name, device: self.device, - doc_name: None, + doc_name: self.doc_name.clone(), } } @@ -83,7 +83,7 @@ impl<'a> ResolverData<'a> { loop_counter_alias: self.loop_counter_alias, inherited_variable_name: self.inherited_variable_name, device, - doc_name: None, + doc_name: self.doc_name.clone(), } } diff --git a/ftd/t/js/27-for-loop.html b/ftd/t/js/27-for-loop.html index e39f5e8740..040b8d3abb 100644 --- a/ftd/t/js/27-for-loop.html +++ b/ftd/t/js/27-for-loop.html @@ -16,7 +16,7 @@ -
undefined Tuesday
undefined Wednesday
undefined Thursday
undefined Friday
undefined Saturday
@@ -33,10 +33,10 @@ return (fastn_utils.getter(index) >= 2); }, function (root) { let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); - rooti0.setProperty(fastn_dom.PropertyKind.StringValue, fastn.formula([global.foo__key, + rooti0.setProperty(fastn_dom.PropertyKind.StringValue, fastn.formula([index, item], function () { return foo__join({ - a: global.foo__key, + a: index, b: item, }, rooti0); }), inherited); diff --git a/ftd/t/js/32-ftd-len.html b/ftd/t/js/32-ftd-len.html index 0c377f2531..fbb2611ba3 100644 --- a/ftd/t/js/32-ftd-len.html +++ b/ftd/t/js/32-ftd-len.html @@ -68,8 +68,8 @@ fastn_utils.getter(global.foo__months).forLoop(root, function (root, item, index) { let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); rooti0.setProperty(fastn_dom.PropertyKind.StringValue, item, inherited); - rooti0.setProperty(fastn_dom.PropertyKind.Color, fastn.formula([global.foo__index, - global.foo__index], function () { + rooti0.setProperty(fastn_dom.PropertyKind.Color, fastn.formula([index, + index], function () { if (function () { return (fastn_utils.getter(index) % 3 == 1); }()) {