Skip to content

Commit

Permalink
don't merge loc's (source maps doesn't support it anyway)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Feb 5, 2017
1 parent 6920da5 commit a42433c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
10 changes: 6 additions & 4 deletions lib/compressor/restructure/2-mergeAtrule.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ function processAtrule(node, item, list) {
prev.expression &&
node.expression.id === prev.expression.id) {
prev.block.children.appendList(node.block.children);
prev.loc = {
primary: prev.loc,
merged: node.loc
};
list.remove(item);

// TODO: use it when we can refer to several points in source
// prev.loc = {
// primary: prev.loc,
// merged: node.loc
// };
}
}

Expand Down
16 changes: 10 additions & 6 deletions lib/compressor/restructure/4-restructShorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,16 @@ TRBL.prototype.add = function(name, declaration) {
return false;
}

if (this.loc) {
this.loc = {
primary: this.loc,
merged: declaration.loc
};
} else {
// TODO: use it when we can refer to several points in source
// if (this.loc) {
// this.loc = {
// primary: this.loc,
// merged: declaration.loc
// };
// } else {
// this.loc = declaration.loc;
// }
if (!this.loc) {
this.loc = declaration.loc;
}

Expand Down
30 changes: 18 additions & 12 deletions lib/compressor/restructure/6-restructBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,32 @@ function processRule(rule, item, list, props, fingerprints) {
};

prev.block.remove(prev.item);
declaration.loc = {
primary: declaration.loc,
merged: prev.item.data.loc
};

// TODO: use it when we can refer to several points in source
// declaration.loc = {
// primary: declaration.loc,
// merged: prev.item.data.loc
// };
} else {
declarations.remove(declarationItem);
prev.item.data.loc = {
primary: prev.item.data.loc,
merged: declaration.loc
};

// TODO: use it when we can refer to several points in source
// prev.item.data.loc = {
// primary: prev.item.data.loc,
// merged: declaration.loc
// };
}
} else {
var prev = needless(props, declaration, fingerprints);

if (prev) {
declarations.remove(declarationItem);
prev.item.data.loc = {
primary: prev.item.data.loc,
merged: declaration.loc
};

// TODO: use it when we can refer to several points in source
// prev.item.data.loc = {
// primary: prev.item.data.loc,
// merged: declaration.loc
// };
} else {
declaration.fingerprint = fingerprint;

Expand Down

0 comments on commit a42433c

Please sign in to comment.