mirror of
https://github.com/marko-js/marko.git
synced 2026-02-01 16:07:13 +00:00
fix: ensure single-reference group exists in a child section that reference its parent's binding
This commit is contained in:
parent
29c36ab690
commit
07639c50c1
@ -0,0 +1,9 @@
|
||||
# Render undefined
|
||||
```html
|
||||
0
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
inserted #text0
|
||||
```
|
||||
@ -0,0 +1,47 @@
|
||||
import { data as _data, setConditionalRenderer as _setConditionalRenderer, queue as _queue, queueInBranch as _queueInBranch, write as _write, createRenderer as _createRenderer, createRenderFn as _createRenderFn } from "@marko/runtime-fluurt/src/dom";
|
||||
|
||||
function _apply1With_a_b(_scope, a = _scope._[4], b = _scope._[5]) {
|
||||
_data(_scope[0], a + b);
|
||||
}
|
||||
|
||||
function _apply1_b(_scope, b = _scope._[5]) {
|
||||
_queue(_scope, _apply1With_a_b, 2);
|
||||
}
|
||||
|
||||
function _apply1_a(_scope, a = _scope._[4]) {
|
||||
_queue(_scope, _apply1With_a_b, 2);
|
||||
}
|
||||
|
||||
function _apply2(_scope) {
|
||||
_queue(_scope, _apply1_b, 1);
|
||||
|
||||
_queue(_scope, _apply1_a, 0);
|
||||
}
|
||||
|
||||
function _apply_b(_scope, b) {
|
||||
if (_write(_scope, 5, b)) _queueInBranch(_scope, 0, _if, _apply1_b, 2, 4);
|
||||
}
|
||||
|
||||
function _apply_a(_scope, a) {
|
||||
if (_write(_scope, 4, a)) _queueInBranch(_scope, 0, _if, _apply1_a, 1, 5);
|
||||
}
|
||||
|
||||
function _apply(_scope) {
|
||||
_apply_a(_scope, 0);
|
||||
|
||||
_apply_b(_scope, 0);
|
||||
|
||||
_setConditionalRenderer(_scope, 0, true ? _if : null);
|
||||
}
|
||||
|
||||
export const template = "<!>";
|
||||
export const walks =
|
||||
/* replace, skip(3), over(1) */
|
||||
"%+b";
|
||||
export const apply = _apply;
|
||||
|
||||
const _if = _createRenderer(" ",
|
||||
/* get */
|
||||
" ", _apply2);
|
||||
|
||||
export default _createRenderFn(template, walks, apply);
|
||||
@ -0,0 +1,19 @@
|
||||
import { markHydrateNode as _markHydrateNode, write as _write, escapeXML as _escapeXML, nextScopeId as _nextScopeId, createRenderer as _createRenderer } from "@marko/runtime-fluurt/src/html";
|
||||
|
||||
const _renderer = input => {
|
||||
const _scope = _nextScopeId();
|
||||
|
||||
const a = 0;
|
||||
const b = 0;
|
||||
|
||||
_write(`${_markHydrateNode(_scope, 0)}`);
|
||||
|
||||
if (true) {
|
||||
const _scope = _nextScopeId();
|
||||
|
||||
_write(`${_markHydrateNode(_scope, 0)}${_escapeXML(a + b)}`);
|
||||
}
|
||||
};
|
||||
|
||||
export default _renderer;
|
||||
export const render = _createRenderer(_renderer);
|
||||
@ -0,0 +1,43 @@
|
||||
# Write
|
||||
<!M#0 0><!M#0 1>0
|
||||
|
||||
|
||||
# Render "End"
|
||||
```html
|
||||
<!--M#0 0-->
|
||||
<!--M#0 1-->
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
0
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
inserted #comment0
|
||||
inserted #comment1
|
||||
inserted html2
|
||||
inserted html2/head0
|
||||
inserted html2/body1
|
||||
inserted html2/body1/#text0
|
||||
```
|
||||
|
||||
|
||||
# Render "Hydrate"
|
||||
```html
|
||||
<!--M#0 0-->
|
||||
<!--M#0 1-->
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
0
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
# Mutations
|
||||
```
|
||||
|
||||
```
|
||||
@ -0,0 +1,5 @@
|
||||
<let/a = 0/>
|
||||
<let/b = 0/>
|
||||
<if=true>
|
||||
${a + b}
|
||||
</if>
|
||||
@ -161,6 +161,8 @@ function updateReferenceGroup(
|
||||
currentGroup.count--;
|
||||
}
|
||||
|
||||
getOrCreateReferenceGroup(sectionId, newBinding);
|
||||
|
||||
path.node.extra![extraKey] = getOrCreateReferenceGroup(
|
||||
sectionId,
|
||||
newReferences
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user