diff --git a/packages/translator-default/src/taglib/core/translate-for.js b/packages/translator-default/src/taglib/core/translate-for.js
index a9f8bbea7..ea54b1d0f 100644
--- a/packages/translator-default/src/taglib/core/translate-for.js
+++ b/packages/translator-default/src/taglib/core/translate-for.js
@@ -19,7 +19,7 @@ export function exit(path) {
if (inAttr) {
allowedAttributes.push("in");
- const [keyParam, valParam] = node.params;
+ const [keyParam, valParam] = node.params || [];
if (!keyParam) {
throw namePath.buildCodeFrameError(
@@ -47,7 +47,7 @@ export function exit(path) {
let ofAttrValue = ofAttr.value;
allowedAttributes.push("of");
- const [valParam, keyParam, loopParam] = node.params;
+ const [valParam, keyParam, loopParam] = node.params || [];
if (!valParam) {
throw namePath.buildCodeFrameError(
@@ -95,7 +95,7 @@ export function exit(path) {
value: t.numericLiteral(1)
};
const stepValue = stepAttr ? stepAttr.value : t.numericLiteral(1);
- const [indexParam] = node.params;
+ const [indexParam] = node.params || [];
const stepsName = path.scope.generateUidIdentifier("steps");
const stepName = path.scope.generateUidIdentifier("step");
diff --git a/packages/translator-default/test/fixtures/for-tag/generated-expected.marko b/packages/translator-default/test/fixtures/for-tag/generated-expected.marko
index bade1faf7..da59da8af 100644
--- a/packages/translator-default/test/fixtures/for-tag/generated-expected.marko
+++ b/packages/translator-default/test/fixtures/for-tag/generated-expected.marko
@@ -60,4 +60,10 @@
+
+
+ Hello
+
+
+ Hello
\ No newline at end of file
diff --git a/packages/translator-default/test/fixtures/for-tag/html-expected.js b/packages/translator-default/test/fixtures/for-tag/html-expected.js
index aa63ea4bd..a15991021 100644
--- a/packages/translator-default/test/fixtures/for-tag/html-expected.js
+++ b/packages/translator-default/test/fixtures/for-tag/html-expected.js
@@ -73,6 +73,14 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component,
_keyScope8 = `[${_keyValue6}]`;
out.w(`
${_marko_escapeXml(i)}
`);
}
+
+ for (let _steps5 = (10 - 0) / 1, _step5 = 0; _step5 <= _steps5; _step5++) {
+ out.w("Hello");
+ }
+
+ for (let _steps6 = (10 - 0) / 1, _step6 = 0; _step6 <= _steps6; _step6++) {
+ out.w("Hello");
+ }
}, {
t: _marko_componentType,
i: true
diff --git a/packages/translator-default/test/fixtures/for-tag/template.marko b/packages/translator-default/test/fixtures/for-tag/template.marko
index de582cda9..bf08fa001 100644
--- a/packages/translator-default/test/fixtures/for-tag/template.marko
+++ b/packages/translator-default/test/fixtures/for-tag/template.marko
@@ -38,11 +38,12 @@
${i}
-
- ${i}
-
-
-
+
+
+ ${i}
+
+
+
@@ -50,3 +51,11 @@
+
+
+ Hello
+
+
+
+ Hello
+
diff --git a/packages/translator-default/test/fixtures/for-tag/vdom-expected.js b/packages/translator-default/test/fixtures/for-tag/vdom-expected.js
index cc45c9f86..f5827cf04 100644
--- a/packages/translator-default/test/fixtures/for-tag/vdom-expected.js
+++ b/packages/translator-default/test/fixtures/for-tag/vdom-expected.js
@@ -118,6 +118,14 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component,
out.e("div", null, "13" + _keyScope8, component, 0, 0);
out.e("div", null, `@other-${i}`, component, 0, 0);
}
+
+ for (let _steps5 = (10 - 0) / 1, _step5 = 0; _step5 <= _steps5; _step5++) {
+ out.t("Hello", component);
+ }
+
+ for (let _steps6 = (10 - 0) / 1, _step6 = 0; _step6 <= _steps6; _step6++) {
+ out.t("Hello", component);
+ }
}, {
t: _marko_componentType,
i: true