-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,157 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/compiler/compile/render_dom/wrappers/shared/mark_each_block_bindings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import EachBlock from "../../../nodes/EachBlock"; | ||
import InlineComponentWrapper from "../InlineComponent"; | ||
import ElementWrapper from "../Element"; | ||
import Binding from "../../../nodes/Binding"; | ||
import get_object from "../../../utils/get_object"; | ||
|
||
export default function mark_each_block_bindings( | ||
parent: ElementWrapper | InlineComponentWrapper, | ||
binding: Binding | ||
) { | ||
// we need to ensure that the each block creates a context including | ||
// the list and the index, if they're not otherwise referenced | ||
const object = get_object(binding.expression.node).name; | ||
const each_block = parent.node.scope.get_owner(object); | ||
(each_block as EachBlock).has_binding = true; | ||
|
||
if (binding.name === "group") { | ||
// for `<input bind:group={} >`, we make sure that all the each blocks creates context with `index` | ||
for (const name of binding.expression.contextual_dependencies) { | ||
const each_block = parent.node.scope.get_owner(name); | ||
(each_block as EachBlock).has_index_binding = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.