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

Unified Diff: tests/compiler/dart2js/kernel/impact_test.dart

Issue 2857373002: Handle more constants in Constantifier (Closed)
Patch Set: Updated cf. comments. Created 3 years, 7 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
« no previous file with comments | « tests/compiler/dart2js/constant_expression_evaluate_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/kernel/impact_test.dart
diff --git a/tests/compiler/dart2js/kernel/impact_test.dart b/tests/compiler/dart2js/kernel/impact_test.dart
index 74cbeee2b9e42249e8b6851c5de62e34dcc87618..1b63ddb6377e87741d27a1275cedcf3860ab279c 100644
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ b/tests/compiler/dart2js/kernel/impact_test.dart
@@ -56,6 +56,7 @@ main() {
testStringJuxtaposition();
testSymbol();
testConstSymbol();
+ testComplexConstSymbol();
testTypeLiteral();
testBoolFromEnvironment();
testEmptyListLiteral();
@@ -217,6 +218,22 @@ testStringInterpolationConst() {
testStringJuxtaposition() => 'a' 'b';
testSymbol() => #main;
testConstSymbol() => const Symbol('main');
+
+const complexSymbolField1 = "true".length == 4;
+const complexSymbolField2 = "true" "false" "${4}${null}";
+const complexSymbolField3 = const {
+ 0.1: const bool.fromEnvironment('a', defaultValue: true),
+ false: const int.fromEnvironment('b', defaultValue: 42),
+ const <int>[]: const String.fromEnvironment('c'),
+ testComplexConstSymbol: #testComplexConstSymbol,
+ 1 + 2: identical(0, -0),
+ true || false: false && true,
+ override: const GenericClass<int, String>.generative(),
+};
+const complexSymbolField =
+ complexSymbolField1 ? complexSymbolField2 : complexSymbolField3;
+testComplexConstSymbol() => const Symbol(complexSymbolField);
+
testTypeLiteral() => Object;
testBoolFromEnvironment() => const bool.fromEnvironment('FOO');
testEmptyListLiteral() => [];
@@ -724,7 +741,7 @@ main(List<String> args) {
Expect.isTrue(await compiler.run(entryPoint));
JavaScriptBackend backend = compiler.backend;
KernelToElementMap kernelElementMap =
- new KernelToElementMap(compiler.reporter);
+ new KernelToElementMap(compiler.reporter, compiler.environment);
kernelElementMap.addProgram(backend.kernelTask.program);
checkLibrary(compiler, kernelElementMap, compiler.mainApp,
« no previous file with comments | « tests/compiler/dart2js/constant_expression_evaluate_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698