File tree 2 files changed +41
-2
lines changed
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -10120,9 +10120,11 @@ Compressor.prototype.compress = function(node) {
10120
10120
}
10121
10121
10122
10122
function can_varify(compressor, sym) {
10123
- if (!sym.fixed_value()) return false;
10124
10123
var def = sym.definition();
10125
- return is_safe_lexical(def) && same_scope(def) && !may_overlap(compressor, def);
10124
+ return (def.fixed || def.fixed === 0)
10125
+ && is_safe_lexical(def)
10126
+ && same_scope(def)
10127
+ && !may_overlap(compressor, def);
10126
10128
}
10127
10129
10128
10130
function varify(self, compressor) {
Original file line number Diff line number Diff line change @@ -194,6 +194,43 @@ scope_adjustment_let: {
194
194
node_version: ">=4"
195
195
}
196
196
197
+ escaped_const: {
198
+ options = {
199
+ reduce_vars : true ,
200
+ toplevel : true ,
201
+ varify : true ,
202
+ }
203
+ input: {
204
+ const log = console . log ;
205
+ log ( "PASS" ) ;
206
+ }
207
+ expect: {
208
+ var log = console . log ;
209
+ log ( "PASS" ) ;
210
+ }
211
+ expect_stdout: "PASS"
212
+ }
213
+
214
+ escaped_let: {
215
+ options = {
216
+ reduce_vars : true ,
217
+ toplevel : true ,
218
+ varify : true ,
219
+ }
220
+ input: {
221
+ "use strict" ;
222
+ let log = console . log ;
223
+ log ( "PASS" ) ;
224
+ }
225
+ expect: {
226
+ "use strict" ;
227
+ var log = console . log ;
228
+ log ( "PASS" ) ;
229
+ }
230
+ expect_stdout: "PASS"
231
+ node_version: ">=4"
232
+ }
233
+
197
234
issue_4191_const: {
198
235
options = {
199
236
functions : true ,
You can’t perform that action at this time.
0 commit comments