Skip to content

Commit 9054c45

Browse files
LuLaValvaDylanPiercey
authored andcommitted
fix: infinite loop at compile time
1 parent 15a999a commit 9054c45

File tree

15 files changed

+221
-1
lines changed

15 files changed

+221
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"vars": {
3+
"props": {
4+
"$_": "t",
5+
"$$myfor_content__i": "o",
6+
"$$myfor_content__$params": "m"
7+
}
8+
}
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Render
2+
```html
3+
012345
4+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Render
2+
```html
3+
<!---->
4+
<!---->
5+
<!---->
6+
0
7+
<!---->
8+
<!---->
9+
1
10+
<!---->
11+
<!---->
12+
2
13+
<!---->
14+
<!---->
15+
3
16+
<!---->
17+
<!---->
18+
4
19+
<!---->
20+
<!---->
21+
5
22+
<!---->
23+
<!---->
24+
<!---->
25+
```
26+
27+
# Mutations
28+
```
29+
INSERT #comment0, #comment1, #comment2, #text0, #comment3, #comment4, #text1, #comment5, #comment6, #text2, #comment7, #comment8, #text3, #comment9, #comment10, #text4, #comment11, #comment12, #text5, #comment13, #comment14, #comment15
30+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export const $template = "<!><!><!>";
2+
export const $walks = /* over(1), replace, over(2) */"b%c";
3+
export const $setup = () => {};
4+
import * as _ from "@marko/runtime-tags/debug/dom";
5+
const $for_content__dynamicTag = /* @__PURE__ */_._dynamic_tag("#text/0", 0, 0, 1);
6+
const $for_content__input_content__OR__args = /* @__PURE__ */_._or(3, $scope => {
7+
let {
8+
_: {
9+
input_content
10+
},
11+
$params2: args
12+
} = $scope;
13+
$for_content__dynamicTag($scope, input_content, () => [...args]);
14+
});
15+
const $for_content__input_content = /* @__PURE__ */_._for_closure("input_content", "#text/0", $for_content__input_content__OR__args);
16+
const $for_content__$params = /* @__PURE__ */_._const("$params2", $for_content__input_content__OR__args);
17+
const $for_content__setup = $for_content__input_content;
18+
const $for_content = /* @__PURE__ */_._content_branch("<!><!><!>", /* over(1), replace, over(2) */"b%c", $for_content__setup, $for_content__$params);
19+
const $for = /* @__PURE__ */_._for_to("#text/0", $for_content);
20+
export const $input_to = /* @__PURE__ */_._const("input_to", ($scope, input_to) => $for($scope, [input_to, 0, 1]));
21+
export const $input = /* @__PURE__ */_._const("input", ($scope, input) => {
22+
$input_to($scope, input.to);
23+
$input_content($scope, input.content);
24+
});
25+
export const $input_content = /* @__PURE__ */_._const("input_content", $for_content__input_content);
26+
export default /* @__PURE__ */_._template("__tests__/tags/my-for.marko", $template, $walks, $setup, $input);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// size: 111 (min) 87 (brotli)
2+
const $myfor_content__i = _._const(2, ($scope, i) => _._text($scope[0], i)),
3+
$myfor_content__$params = _._const(1, ($scope, $params2) =>
4+
$myfor_content__i($scope, $params2[0]),
5+
);
6+
_._content_resume("b0", " ", " b", 0, $myfor_content__$params);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const $template = `<!>${_myFor_template}<!>`;
2+
export const $walks = /* over(1), beginChild, _myFor_walks, endChild, over(1) */`b/${_myFor_walks}&b`;
3+
import * as _ from "@marko/runtime-tags/debug/dom";
4+
import { $setup as _myFor, $input_content as _myFor_input_content, $input_to as _myFor_input_to, $template as _myFor_template, $walks as _myFor_walks } from "./tags/my-for.marko";
5+
const $myfor_content__i = /* @__PURE__ */_._const("i", ($scope, i) => _._text($scope["#text/0"], i));
6+
const $myfor_content__$params = /* @__PURE__ */_._const("$params2", ($scope, $params2) => $myfor_content__i($scope, $params2[0]));
7+
const $myfor_content = _._content_resume("__tests__/template.marko_1_content", " ", /* get, over(1) */" b", 0, $myfor_content__$params);
8+
export function $setup($scope) {
9+
_myFor($scope["#childScope/0"]);
10+
_myFor_input_content($scope["#childScope/0"], $myfor_content($scope));
11+
_myFor_input_to($scope["#childScope/0"], 5);
12+
}
13+
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as _ from "@marko/runtime-tags/debug/html";
2+
export default _._template("__tests__/tags/my-for.marko", (input, $serialize) => {
3+
const $scope0_id = _._scope_id();
4+
_._for_to(input.to, 0, 1, (...args) => {
5+
const $scope1_id = _._scope_id();
6+
_._dynamic_tag($scope1_id, "#text/0", input.content, [...args], 0, 1, _._serialize_guard($serialize, /* input.to,input.content */0));
7+
_._serialize_guard($serialize, /* input.to,input.content */0) && _._scope($scope1_id, {
8+
$params2: _._serialize_if($serialize, /* input.content */2) && $params2,
9+
_: _._scope_with_id($scope0_id)
10+
}, "__tests__/tags/my-for.marko", "1:2", {
11+
$params2: "1:9"
12+
});
13+
}, 0, $scope0_id, "#text/0", _._serialize_guard($serialize, /* input.to,input.content */0), _._serialize_guard($serialize, /* input.to */1));
14+
_._serialize_guard($serialize, /* input.to */1) && _._scope($scope0_id, {
15+
input_content: input.content
16+
}, "__tests__/tags/my-for.marko", 0, {
17+
input_content: ["input.content"]
18+
});
19+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as _ from "@marko/runtime-tags/debug/html";
2+
import _myFor from "./tags/my-for.marko";
3+
export default _._template("__tests__/template.marko", input => {
4+
const $scope0_id = _._scope_id();
5+
_myFor({
6+
to: 5,
7+
content: _._content_resume("__tests__/template.marko_1_content", i => {
8+
const $scope1_id = _._scope_id();
9+
_._html(`${_._escape(i)}${_._el_resume($scope1_id, "#text/0")}`);
10+
_._scope($scope1_id, {}, "__tests__/template.marko", "1:2");
11+
}, $scope0_id)
12+
});
13+
});
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Render
2+
```html
3+
012345
4+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Render
2+
```html
3+
<html>
4+
<head />
5+
<body>
6+
0
7+
<!--M_*4 #text/0-->
8+
1
9+
<!--M_*6 #text/0-->
10+
2
11+
<!--M_*8 #text/0-->
12+
3
13+
<!--M_*10 #text/0-->
14+
4
15+
<!--M_*12 #text/0-->
16+
5
17+
<!--M_*14 #text/0-->
18+
<script>
19+
WALKER_RUNTIME("M")("_");
20+
M._.r = [_ =&gt; (_.a = [0, 3,
21+
{}, 1,
22+
{}, 1,
23+
{}, 1,
24+
{}, 1,
25+
{}, 1,
26+
{}])]
27+
</script>
28+
</body>
29+
</html>
30+
```

0 commit comments

Comments
 (0)