Re-add the collapsibility check mistakenly removed by
When the property collapse level is MODULE_EXPORT, only module exports themselves may be collapsed. Nested and unrelated properties may not be.
@@ -360,8 +360,11 @@ class CollapseProperties implements CompilerPass {
for (Name p : n.props) {
String propAlias = appendPropForAlias(alias, p.getBaseName());
-
final Inlinability inlinability = p.canCollapseOrInline();
+
+ boolean isAllowedToCollapse =
+ propertyCollapseLevel != PropertyCollapseLevel.MODULE_EXPORT || p.isModuleExport();
+ if (isAllowedToCollapse) {
if (inlinability.canCollapse()) {
logDecisionForName(p, inlinability, "will flatten references");
flattenReferencesTo(p, propAlias);
@@ -373,6 +376,7 @@ class CollapseProperties implements CompilerPass {
} else {
logDecisionForName(p, inlinability, "will not flatten references");
}
+ }
flattenReferencesToCollapsibleDescendantNames(p, propAlias, escaped);
}
