Skip to content

Commit

Permalink
fix: issue with multiple gets before attrs/return
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Oct 28, 2021
1 parent 907ab23 commit 6f9840c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/util/is-at-root.ts
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))
);
}

0 comments on commit 6f9840c

Please sign in to comment.