@hyperframes/parsers 0.8.81 → 0.8.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1435,14 +1435,15 @@ function isTimelineRooted(node, timelineVar, script) {
1435
1435
  return false;
1436
1436
  }
1437
1437
  function findInsertionPoint(parsed) {
1438
+ const tlDecl = findTimelineDeclarationStatement(parsed.ast, parsed.timelineVar);
1438
1439
  const lastLocated = parsed.located[parsed.located.length - 1];
1439
1440
  if (lastLocated) {
1440
1441
  const lastCall = lastLocated.call;
1441
1442
  const exprStmt = findEnclosingExpressionStatement(lastCall.ancestors);
1442
- return exprStmt?.end ?? lastCall.node.end;
1443
+ const lastCallEnd = exprStmt?.end ?? lastCall.node.end;
1444
+ return Math.max(lastCallEnd, tlDecl?.end ?? 0);
1443
1445
  }
1444
1446
  if (!parsed.hasTimeline) return null;
1445
- const tlDecl = findTimelineDeclarationStatement(parsed.ast, parsed.timelineVar);
1446
1447
  return tlDecl?.end ?? parsed.ast.end;
1447
1448
  }
1448
1449
  function findGlobalSetInsertionPoint(parsed, script) {