Files
sdk/pkg/compiler/test/codegen/data_2/unused_empty_map.dart
T
Stephen Adams 5c2ca380a4 [dart2js] Tag all sources with @dart = 2.10
Change-Id: Ie9c7548dc81b58db0c1149124db79e4cf1430cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239723
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-04-06 21:31:45 +00:00

63 lines
1.1 KiB
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.10
// ignore_for_file: unused_local_variable
@pragma('dart2js:noInline')
// No code to construct unused map.
/*member: foo1:function() {
return;
}*/
void foo1() {
var x = {};
return;
}
@pragma('dart2js:noInline')
// No code to construct unused maps.
/*member: foo2:function() {
return;
}*/
void foo2() {
var x = {};
var y = <String, String>{};
return;
}
@pragma('dart2js:noInline')
// No code to construct maps which become unused after list is removed.
/*member: foo3:function() {
return;
}*/
void foo3() {
var x = [{}, {}];
return;
}
@pragma('dart2js:noInline')
// Constructor is inlined, allocation is removed, leaving maps unused.
/*member: foo4:function() {
return;
}*/
void foo4() {
var x = AAA4({});
return;
}
class AAA4 {
Map<String, String> field1 = {};
Map<String, int> field2;
AAA4(this.field2);
}
/*member: main:ignore*/
main() {
foo1();
foo2();
foo3();
foo4();
}