mirror of
https://github.com/marko-js/marko.git
synced 2026-02-01 16:07:13 +00:00
fix: compile error on analyzing exported function
This commit is contained in:
parent
59d0100319
commit
74332ef7fe
5
.changeset/metal-lies-join.md
Normal file
5
.changeset/metal-lies-join.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@marko/runtime-tags": patch
|
||||
---
|
||||
|
||||
Fix issue reading trying to get the root function from a exported function.
|
||||
@ -31,8 +31,6 @@ export function getFnRoot(path: t.NodePath<t.Node>) {
|
||||
| t.NodePath<
|
||||
t.FunctionExpression | t.ArrowFunctionExpression | t.ObjectMember
|
||||
>;
|
||||
if (curPath.isProgram()) return;
|
||||
|
||||
while (!isMarko(curPath)) {
|
||||
if (isFunction(curPath)) {
|
||||
fnPath = curPath;
|
||||
@ -45,7 +43,12 @@ export function getFnRoot(path: t.NodePath<t.Node>) {
|
||||
}
|
||||
}
|
||||
|
||||
curPath = (curPath as t.NodePath<t.Node>).parentPath!;
|
||||
const parentPath = curPath.parentPath;
|
||||
if (parentPath) {
|
||||
curPath = parentPath;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return fnPath;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user