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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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/map_tracer_keys_test.dart ('k') | tests/compiler/dart2js/members_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/map_tracer_test.dart
diff --git a/tests/compiler/dart2js/map_tracer_test.dart b/tests/compiler/dart2js/map_tracer_test.dart
index 1f313dada2985ffcd12082a17d5c582fee93f834..1f8e806c1bc591cc19e1614e9a72a666c03d8ce8 100644
--- a/tests/compiler/dart2js/map_tracer_test.dart
+++ b/tests/compiler/dart2js/map_tracer_test.dart
@@ -4,13 +4,11 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
-import 'package:compiler/src/types/types.dart'
- show MapTypeMask, TypeMask;
+import 'package:compiler/src/types/types.dart' show MapTypeMask, TypeMask;
import 'compiler_helper.dart';
import 'type_mask_test_helper.dart';
-
String generateTest(String mapAllocation) {
return """
int anInt = 42;
@@ -209,77 +207,80 @@ void main() {
doTest('{aDouble : anInt}', "aDouble", "anInt");
}
-void doTest(String allocation, [String keyElement,
- String valueElement]) {
+void doTest(String allocation, [String keyElement, String valueElement]) {
Uri uri = new Uri(scheme: 'source');
var compiler = compilerFor(generateTest(allocation), uri,
expectedErrors: 0, expectedWarnings: 1);
var classWorld = compiler.world;
asyncTest(() => compiler.run(uri).then((_) {
- var keyType, valueType;
- var commonMasks = compiler.commonMasks;
- var typesInferrer = compiler.globalInference.typesInferrer;
- var emptyType = new TypeMask.nonNullEmpty();
- var aKeyType =
- typesInferrer.getTypeOfElement(findElement(compiler, 'aKey'));
- if (keyElement != null) {
- keyType =
- typesInferrer.getTypeOfElement(findElement(compiler, keyElement));
- }
- if (valueElement != null) {
- valueType =
- typesInferrer.getTypeOfElement(findElement(compiler, valueElement));
- }
- if (keyType == null) keyType = emptyType;
- if (valueType == null) valueType = emptyType;
-
- checkType(String name, keyType, valueType) {
- var element = findElement(compiler, name);
- MapTypeMask mask = typesInferrer.getTypeOfElement(element);
- Expect.equals(keyType, simplify(mask.keyType, compiler), name);
- Expect.equals(valueType, simplify(mask.valueType, compiler), name);
- }
-
- K(TypeMask other) => simplify(keyType.union(other, classWorld), compiler);
- V(TypeMask other) =>
- simplify(valueType.union(other, classWorld), compiler).nullable();
-
- checkType('mapInField', K(aKeyType), V(commonMasks.numType));
- checkType('mapPassedToMethod', K(aKeyType), V(commonMasks.numType));
- checkType('mapReturnedFromMethod', K(aKeyType), V(commonMasks.numType));
- checkType('mapUsedWithCascade', K(aKeyType), V(commonMasks.numType));
- checkType('mapUsedInClosure', K(aKeyType), V(commonMasks.numType));
- checkType('mapPassedToSelector', K(aKeyType), V(commonMasks.numType));
- checkType('mapReturnedFromSelector', K(aKeyType), V(commonMasks.numType));
- checkType('mapUsedWithConstraint', K(aKeyType), V(commonMasks.uint31Type));
- checkType('mapEscapingFromSetter', K(aKeyType), V(commonMasks.numType));
- checkType('mapUsedInLocal', K(aKeyType), V(commonMasks.numType));
- checkType('mapEscapingInSetterValue', K(aKeyType), V(commonMasks.numType));
- checkType('mapEscapingInIndex', K(aKeyType), V(commonMasks.numType));
- checkType('mapEscapingInIndexSet', K(aKeyType), V(commonMasks.uint31Type));
- checkType('mapEscapingTwiceInIndexSet',
- K(aKeyType), V(commonMasks.numType));
- checkType('mapSetInNonFinalField', K(aKeyType), V(commonMasks.numType));
-
- checkType('mapPassedToClosure', K(commonMasks.dynamicType),
- V(commonMasks.dynamicType));
- checkType('mapReturnedFromClosure', K(commonMasks.dynamicType),
- V(commonMasks.dynamicType));
- checkType('mapUsedWithNonOkSelector', K(commonMasks.dynamicType),
- V(commonMasks.dynamicType));
- checkType('mapPassedAsOptionalParameter', K(aKeyType),
- V(commonMasks.numType));
- checkType('mapPassedAsNamedParameter', K(aKeyType),
- V(commonMasks.numType));
- checkType('mapStoredInList', K(aKeyType),
- V(commonMasks.uint31Type));
- checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType),
- V(commonMasks.dynamicType));
- checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type));
- checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType),
- V(commonMasks.dynamicType));
-
- checkType('mapUnset', K(emptyType), V(emptyType));
- checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType));
- }));
+ var keyType, valueType;
+ var commonMasks = compiler.commonMasks;
+ var typesInferrer = compiler.globalInference.typesInferrer;
+ var emptyType = new TypeMask.nonNullEmpty();
+ var aKeyType =
+ typesInferrer.getTypeOfElement(findElement(compiler, 'aKey'));
+ if (keyElement != null) {
+ keyType =
+ typesInferrer.getTypeOfElement(findElement(compiler, keyElement));
+ }
+ if (valueElement != null) {
+ valueType = typesInferrer
+ .getTypeOfElement(findElement(compiler, valueElement));
+ }
+ if (keyType == null) keyType = emptyType;
+ if (valueType == null) valueType = emptyType;
+
+ checkType(String name, keyType, valueType) {
+ var element = findElement(compiler, name);
+ MapTypeMask mask = typesInferrer.getTypeOfElement(element);
+ Expect.equals(keyType, simplify(mask.keyType, compiler), name);
+ Expect.equals(valueType, simplify(mask.valueType, compiler), name);
+ }
+
+ K(TypeMask other) =>
+ simplify(keyType.union(other, classWorld), compiler);
+ V(TypeMask other) =>
+ simplify(valueType.union(other, classWorld), compiler).nullable();
+
+ checkType('mapInField', K(aKeyType), V(commonMasks.numType));
+ checkType('mapPassedToMethod', K(aKeyType), V(commonMasks.numType));
+ checkType('mapReturnedFromMethod', K(aKeyType), V(commonMasks.numType));
+ checkType('mapUsedWithCascade', K(aKeyType), V(commonMasks.numType));
+ checkType('mapUsedInClosure', K(aKeyType), V(commonMasks.numType));
+ checkType('mapPassedToSelector', K(aKeyType), V(commonMasks.numType));
+ checkType(
+ 'mapReturnedFromSelector', K(aKeyType), V(commonMasks.numType));
+ checkType(
+ 'mapUsedWithConstraint', K(aKeyType), V(commonMasks.uint31Type));
+ checkType('mapEscapingFromSetter', K(aKeyType), V(commonMasks.numType));
+ checkType('mapUsedInLocal', K(aKeyType), V(commonMasks.numType));
+ checkType(
+ 'mapEscapingInSetterValue', K(aKeyType), V(commonMasks.numType));
+ checkType('mapEscapingInIndex', K(aKeyType), V(commonMasks.numType));
+ checkType(
+ 'mapEscapingInIndexSet', K(aKeyType), V(commonMasks.uint31Type));
+ checkType(
+ 'mapEscapingTwiceInIndexSet', K(aKeyType), V(commonMasks.numType));
+ checkType('mapSetInNonFinalField', K(aKeyType), V(commonMasks.numType));
+
+ checkType('mapPassedToClosure', K(commonMasks.dynamicType),
+ V(commonMasks.dynamicType));
+ checkType('mapReturnedFromClosure', K(commonMasks.dynamicType),
+ V(commonMasks.dynamicType));
+ checkType('mapUsedWithNonOkSelector', K(commonMasks.dynamicType),
+ V(commonMasks.dynamicType));
+ checkType('mapPassedAsOptionalParameter', K(aKeyType),
+ V(commonMasks.numType));
+ checkType(
+ 'mapPassedAsNamedParameter', K(aKeyType), V(commonMasks.numType));
+ checkType('mapStoredInList', K(aKeyType), V(commonMasks.uint31Type));
+ checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType),
+ V(commonMasks.dynamicType));
+ checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type));
+ checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType),
+ V(commonMasks.dynamicType));
+
+ checkType('mapUnset', K(emptyType), V(emptyType));
+ checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType));
+ }));
}
« no previous file with comments | « tests/compiler/dart2js/map_tracer_keys_test.dart ('k') | tests/compiler/dart2js/members_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698