-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue with multiple gets before attrs/return
- Loading branch information
1 parent
907ab23
commit 6f9840c
Showing
1 changed file
with
5 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { types as t } from "@marko/compiler"; | ||
import isCoreTag from "./is-core-tag"; | ||
|
||
export default function isAtRoot(tag: t.NodePath<t.MarkoTag>) { | ||
export default function isAtRoot(tag: t.NodePath<t.MarkoTag>): boolean { | ||
const parentPath = tag.parentPath.parentPath!; | ||
// Special case `<get>` since it currently wraps it's children | ||
// which is an implementation detail. | ||
return parentPath!.isProgram() || isCoreTag("get", parentPath); | ||
return ( | ||
parentPath!.isProgram() || | ||
(isCoreTag("get", parentPath) && isAtRoot(parentPath)) | ||
); | ||
} |