aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-30 03:49:39 +0800
committerGitHub <noreply@github.com>2019-10-30 03:49:39 +0800
commit0f4cfa877a9f14a75b219c04947ce5984772d8ba (patch)
treef06c7ea1744fff0afd911816806da82951c9ca57 /lib
parent1d5c2becbd4e0266a702db93649dbe025056b885 (diff)
downloadtracifyjs-0f4cfa877a9f14a75b219c04947ce5984772d8ba.tar.gz
tracifyjs-0f4cfa877a9f14a75b219c04947ce5984772d8ba.zip
fix corner case in `comments` (#3550)
Diffstat (limited to 'lib')
-rw-r--r--lib/parse.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/parse.js b/lib/parse.js
index 7321878f..16d8dad3 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -1253,6 +1253,7 @@ function parse($TEXT, options) {
var ex = expression(true);
var len = start.comments_before.length;
[].unshift.apply(ex.start.comments_before, start.comments_before);
+ start.comments_before.length = 0;
start.comments_before = ex.start.comments_before;
start.comments_before_length = len;
if (len == 0 && start.comments_before.length > 0) {
@@ -1268,6 +1269,7 @@ function parse($TEXT, options) {
var end = prev();
end.comments_before = ex.end.comments_before;
[].push.apply(ex.end.comments_after, end.comments_after);
+ end.comments_after.length = 0;
end.comments_after = ex.end.comments_after;
ex.end = end;
if (ex instanceof AST_Call) mark_pure(ex);