fix corner case in conditionals (#5548)

This commit is contained in:
Alex Lam S.L
2022-07-07 14:28:33 +01:00
committed by GitHub
parent 902292f776
commit b92a89f325
2 changed files with 19 additions and 1 deletions

View File

@@ -1428,8 +1428,10 @@ var AST_Import = DEFNODE("Import", "all default path properties quote", {
}, },
_equals: function(node) { _equals: function(node) {
return this.path == node.path return this.path == node.path
&& prop_equals(this.all, node.all)
&& prop_equals(this.default, node.default) && prop_equals(this.default, node.default)
&& (this.all ? prop_equals(this.all, node.all) : all_equals(this.properties, node.properties)); && !this.properties == !node.properties
&& (!this.properties || all_equals(this.properties, node.properties));
}, },
walk: function(visitor) { walk: function(visitor) {
var node = this; var node = this;

View File

@@ -193,6 +193,22 @@ forbid_merge: {
} }
} }
merge_tail: {
options = {
conditionals: true,
}
input: {
if (console)
import "foo";
else
import "foo";
}
expect: {
console;
import "foo";
}
}
issue_4708_1: { issue_4708_1: {
options = { options = {
imports: true, imports: true,