Skip to content

Commit 3307d06

Browse files
committed
refactor: nit
1 parent ca081d4 commit 3307d06

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

  • packages/plugin-rsc/src/transforms

packages/plugin-rsc/src/transforms/hoist.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function getBindVars(fn: Node, scopeTree: ScopeTree): BindVar[] {
188188
const ancestorScopes = fnScope.getAncestorScopes()
189189
const references = scopeTree.scopeToReferences.get(fnScope) ?? []
190190

191-
// Same filtering as before: declared in an ancestor scope, not module scope
191+
// bind references that are declared in an ancestor scope, but not module scope nor global
192192
const bindReferences = references.filter((id) => {
193193
const scope = scopeTree.referenceToDeclaredScope.get(id)
194194
return scope && scope !== scopeTree.moduleScope && ancestorScopes.has(scope)
@@ -264,7 +264,9 @@ function antichainDedupe(paths: BindPath[]): BindPath[] {
264264
const covered = retained.some(
265265
(r) => path.key === r.key || path.key.startsWith(r.key + '.'),
266266
)
267-
if (!covered) retained.push(path)
267+
if (!covered) {
268+
retained.push(path)
269+
}
268270
}
269271
return retained
270272
}
@@ -300,9 +302,9 @@ function synthesizePartialObject(rootName: string, paths: BindPath[]): string {
300302
return `{ ${entries} }`
301303
}
302304

303-
return serialize(trie)
304-
}
305+
function synthesizeMemberAccess(root: string, segments: string[]): string {
306+
return root + segments.map((segment) => `.${segment}`).join('')
307+
}
305308

306-
function synthesizeMemberAccess(root: string, segments: string[]): string {
307-
return root + segments.map((segment) => `.${segment}`).join('')
309+
return serialize(trie)
308310
}

0 commit comments

Comments
 (0)