From 7457478ab5223f2b99eda27a5439468a62ef4003 Mon Sep 17 00:00:00 2001 From: kzc Date: Sat, 15 May 2021 00:30:22 -0400 Subject: [PATCH] fix comment regarding invalid annotation handling (#4081) --- src/utils/pureComments.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/pureComments.ts b/src/utils/pureComments.ts index bad56369326..bf95fb8fff8 100644 --- a/src/utils/pureComments.ts +++ b/src/utils/pureComments.ts @@ -32,8 +32,11 @@ function isOnlyWhitespaceOrComments(code: string) { const ast = acorn.parse(code, { ecmaVersion: 'latest' }) as any; return ast.body && ast.body.length === 0; } catch { - // should never be reached - - // the entire module was previously successfully parsed + // should only be reached by invalid annotations like: + // + // foo() /*@__PURE__*/ /* other */, bar(); + // + // where `code` is " /* other */, " } return false; }