fix(core): rewrite replacements while hoisting layers (#35176)
This commit is contained in:
parent
1fa605ad5e
commit
a2769b5ade
2 changed files with 5 additions and 1 deletions
|
|
@ -230,7 +230,7 @@ export function hoist<A, E, T extends Tag, const Items extends Replacements = re
|
||||||
if (existing && existing !== node) {
|
if (existing && existing !== node) {
|
||||||
throw new Error(`Tag ${tag} has conflicting implementations for ${node.name}`)
|
throw new Error(`Tag ${tag} has conflicting implementations for ${node.name}`)
|
||||||
}
|
}
|
||||||
hoisted.set(node.name, node)
|
hoisted.set(node.name, rewriteReplacementDependencies(node, replacementMap))
|
||||||
return group([])
|
return group([])
|
||||||
}
|
}
|
||||||
if (node.kind === "unbound") {
|
if (node.kind === "unbound") {
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,10 @@ export function buildLocationServiceMap(
|
||||||
LayerMap.make(
|
LayerMap.make(
|
||||||
(ref: Location.Ref) => {
|
(ref: Location.Ref) => {
|
||||||
const allReplacements = replacements.concat([[Location.node, Location.boundNode(ref)]])
|
const allReplacements = replacements.concat([[Location.node, Location.boundNode(ref)]])
|
||||||
|
// Apply replacements during hoist, not afterward: replacements can
|
||||||
|
// introduce new tagged dependencies (Location.boundNode depends on
|
||||||
|
// Project), and the hoist walk is the only pass that can still slice
|
||||||
|
// those back out.
|
||||||
const location = LayerNode.hoist(locationServices, Node.tags.values.global, allReplacements)
|
const location = LayerNode.hoist(locationServices, Node.tags.values.global, allReplacements)
|
||||||
|
|
||||||
return LayerNode.compile(location.node).pipe(
|
return LayerNode.compile(location.node).pipe(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue