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

Unified Diff: tests/compiler/dart2js/backend_dart/opt_constprop_test.dart

Issue 800433003: First version of typr propagation in the new IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add type arguments, fix join and tests. Created 6 years 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/backend_dart/opt_constprop_test.dart
diff --git a/tests/compiler/dart2js/backend_dart/opt_constprop_test.dart b/tests/compiler/dart2js/backend_dart/opt_constprop_test.dart
index cb158e78ca66500929533aeb7c3342f90f31448a..971ed04f17659e07845deeae2db25894415599af 100644
--- a/tests/compiler/dart2js/backend_dart/opt_constprop_test.dart
+++ b/tests/compiler/dart2js/backend_dart/opt_constprop_test.dart
@@ -395,6 +395,26 @@ String normalizeSExpr(String input) {
return input.replaceAll(new RegExp(r'[ \n\t]+'), ' ').trim();
}
+class UnitTypeSystem implements TypeSystem<String> {
+ static const String UNIT = 'unit';
+
+ get boolType => UNIT;
+ get dynamicType => UNIT;
+ get functionType => UNIT;
+ get intType => UNIT;
+ get listType => UNIT;
+ get mapType => UNIT;
+ get stringType => UNIT;
+ get typeType => UNIT;
+
+ bool areEqual(a, b) => true;
+ bool areAssignable(a, b) => true;
+ getParameterType(_) => UNIT;
+ getReturnType(_) => UNIT;
+ join(a, b) => UNIT;
+ typeOf(_) => UNIT;
+}
+
/// Parses the given input IR, runs an optimization pass over it, and compares
/// the stringification of the result against the expected output.
Future testConstantPropagator(String input, String expectedOutput) {
@@ -404,8 +424,11 @@ Future testConstantPropagator(String input, String expectedOutput) {
return compiler.init().then((_) {
final unstringifier = new SExpressionUnstringifier();
final stringifier = new SExpressionStringifier();
- final optimizer = new ConstantPropagator(
- compiler, dart2js.DART_CONSTANT_SYSTEM);
+ final optimizer = new TypePropagator(
+ compiler,
+ dart2js.DART_CONSTANT_SYSTEM,
+ new UnitTypeSystem(),
+ compiler.internalError);
final f = unstringifier.unstringify(input);
optimizer.rewrite(f);

Powered by Google App Engine
This is Rietveld 408576698