Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: tests/compiler/dart2js/emit_const_fields_test.dart

Issue 12095034: dart2js: Don't emit static const fields since they are inlined where they are used (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/emit_const_fields_test.dart
diff --git a/tests/compiler/dart2js/emit_const_fields_test.dart b/tests/compiler/dart2js/emit_const_fields_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..63d0ce7ec0a12e83fbf143ca16234e04984883f7
--- /dev/null
+++ b/tests/compiler/dart2js/emit_const_fields_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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.
+// Test that unused static consts are not emitted.
+
+import 'compiler_helper.dart';
+import 'parser_helper.dart';
ngeoffray 2013/01/29 11:19:38 Do you need parser_helper?
erikcorry 2013/02/04 11:38:01 No. Removed.
+
+const String TEST_GUIDE = r"""
+class Guide {
+ static const LTUAE = 42;
+ static const TITLE = 'Life, the Universe and Everything';
+}
+
+main() {
+ return "${Guide.LTUAE}, ${Guide.TITLE}";
+}
+""";
+
+main() {
+ String generated = compileAll(TEST_GUIDE);
+ Expect.isTrue(generated.contains("42"));
+ Expect.isFalse(generated.contains("TITLE"));
+}
+
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/compile_time_constants.dart ('k') | tests/language/emit_const_fields_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698