diff --git a/lib/compress/inline.js b/lib/compress/inline.js index eec4c5c91..b36bbfe04 100644 --- a/lib/compress/inline.js +++ b/lib/compress/inline.js @@ -210,7 +210,7 @@ export function inline_into_symbolref(self, compressor) { } } - if (single_use && fixed instanceof AST_Lambda) { + if (single_use && (fixed instanceof AST_Lambda || fixed instanceof AST_Class)) { single_use = def.scope === self.scope && !scope_encloses_variables_in_this_scope(nearest_scope, fixed) diff --git a/lib/parse.js b/lib/parse.js index 1b85b5674..e247f6f90 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -2801,14 +2801,14 @@ function parse($TEXT, options) { var end = prev(); name = name || new type({ - name: "*", start: start, + name: "*", end: end, }); foreign_name = new foreign_type({ - name: "*", start: start, + name: "*", end: end, }); diff --git a/test/compress/inline.js b/test/compress/inline.js index 57b2a885b..92d267882 100644 --- a/test/compress/inline.js +++ b/test/compress/inline.js @@ -238,6 +238,40 @@ inline_into_scope_conflict_enclosed_2: { ] } +issue_1267_inline_breaks_compare_identity: { + options = { + toplevel: true + } + input: { + class ClassA { + } + class ClassB { + MyA = ClassA; + }; + + console.log(new ClassB().MyA == new ClassB().MyA) + } + expect_stdout: ["true"] +} + +issue_1267_inline_breaks_compare_identity_2: { + options = { + toplevel: true + } + input: { + class ClassA { + } + const objA = { + prop: ClassA + } + const objB = { + prop: ClassA + } + + console.log(objA.prop === objB.prop) + } + expect_stdout: ["true"] +} noinline_annotation: { options = {