fix comment parsing around parentheses
This commit is contained in:
parent
11f1beb337
commit
5713261fbf
15
lib/parse.js
15
lib/parse.js
|
|
@ -1276,11 +1276,11 @@ function parse($TEXT, options) {
|
||||||
case "(":
|
case "(":
|
||||||
next();
|
next();
|
||||||
var ex = expression(true);
|
var ex = expression(true);
|
||||||
var orig_len = start.comments_before.length;
|
var len = start.comments_before.length;
|
||||||
start.comments_before.orig_len = orig_len;
|
[].unshift.apply(ex.start.comments_before, start.comments_before);
|
||||||
[].push.apply(start.comments_before, ex.start.comments_before);
|
start.comments_before = ex.start.comments_before;
|
||||||
ex.start.comments_before = start.comments_before;
|
start.comments_before_length = len;
|
||||||
if (orig_len == 0 && start.comments_before.length > 0) {
|
if (len == 0 && start.comments_before.length > 0) {
|
||||||
var comment = start.comments_before[0];
|
var comment = start.comments_before[0];
|
||||||
if (!comment.nlb) {
|
if (!comment.nlb) {
|
||||||
comment.nlb = start.nlb;
|
comment.nlb = start.nlb;
|
||||||
|
|
@ -1444,8 +1444,9 @@ function parse($TEXT, options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function mark_pure(call) {
|
function mark_pure(call) {
|
||||||
var comments = call.start.comments_before;
|
var start = call.start;
|
||||||
var i = HOP(comments, "orig_len") ? comments.orig_len : comments.length;
|
var comments = start.comments_before;
|
||||||
|
var i = HOP(start, "comments_before_length") ? start.comments_before_length : comments.length;
|
||||||
while (--i >= 0) {
|
while (--i >= 0) {
|
||||||
var comment = comments[i];
|
var comment = comments[i];
|
||||||
if (/[@#]__PURE__/.test(comment.value)) {
|
if (/[@#]__PURE__/.test(comment.value)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user