Index: tests/compiler/dart2js/type_test_helper.dart |
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart |
index 5e91f774939c3dbf5f7c17959b033e828f552de9..cc0ae9093ed3c9868627c969682a8de905e24ebd 100644 |
--- a/tests/compiler/dart2js/type_test_helper.dart |
+++ b/tests/compiler/dart2js/type_test_helper.dart |
@@ -11,16 +11,12 @@ import 'memory_compiler.dart' as memory; |
import 'package:compiler/src/common/resolution.dart'; |
import 'package:compiler/src/commandline_options.dart'; |
import 'package:compiler/src/dart_types.dart'; |
-import 'package:compiler/src/compiler.dart' |
- show Compiler; |
+import 'package:compiler/src/compiler.dart' show Compiler; |
import 'package:compiler/src/elements/elements.dart' |
- show Element, |
- MemberElement, |
- TypeDeclarationElement, |
- ClassElement; |
+ show Element, MemberElement, TypeDeclarationElement, ClassElement; |
-GenericType instantiate(TypeDeclarationElement element, |
- List<DartType> arguments) { |
+GenericType instantiate( |
+ TypeDeclarationElement element, List<DartType> arguments) { |
if (element.isClass) { |
return new InterfaceType(element, arguments); |
} else { |
@@ -34,12 +30,12 @@ class TypeEnvironment { |
Resolution get resolution => compiler.resolution; |
- static Future<TypeEnvironment> create( |
- String source, {bool useMockCompiler: true, |
- bool expectNoErrors: false, |
- bool expectNoWarningsOrErrors: false, |
- bool stopAfterTypeInference: false, |
- String mainSource}) { |
+ static Future<TypeEnvironment> create(String source, |
+ {bool useMockCompiler: true, |
+ bool expectNoErrors: false, |
+ bool expectNoWarningsOrErrors: false, |
+ bool stopAfterTypeInference: false, |
+ String mainSource}) { |
Uri uri; |
Compiler compiler; |
bool stopAfterTypeInference = mainSource != null; |
@@ -53,9 +49,7 @@ class TypeEnvironment { |
memory.DiagnosticCollector collector; |
if (useMockCompiler) { |
uri = new Uri(scheme: 'source'); |
- mock.MockCompiler mockCompiler = mock.compilerFor( |
- source, |
- uri, |
+ mock.MockCompiler mockCompiler = mock.compilerFor(source, uri, |
analyzeAll: !stopAfterTypeInference, |
analyzeOnly: !stopAfterTypeInference); |
mockCompiler.diagnosticHandler = mock.createHandler(mockCompiler, source); |
@@ -69,19 +63,18 @@ class TypeEnvironment { |
memorySourceFiles: {'main.dart': source}, |
diagnosticHandler: collector, |
options: stopAfterTypeInference |
- ? [] : [Flags.analyzeAll, Flags.analyzeOnly]); |
+ ? [] |
+ : [Flags.analyzeAll, Flags.analyzeOnly]); |
} |
compiler.stopAfterTypeInference = stopAfterTypeInference; |
return compiler.run(uri).then((_) { |
if (expectNoErrors || expectNoWarningsOrErrors) { |
var errors = collector.errors; |
- Expect.isTrue(errors.isEmpty, |
- 'Unexpected errors: ${errors}'); |
+ Expect.isTrue(errors.isEmpty, 'Unexpected errors: ${errors}'); |
} |
if (expectNoWarningsOrErrors) { |
var warnings = collector.warnings; |
- Expect.isTrue(warnings.isEmpty, |
- 'Unexpected warnings: ${warnings}'); |
+ Expect.isTrue(warnings.isEmpty, 'Unexpected warnings: ${warnings}'); |
} |
return new TypeEnvironment._(compiler); |
}); |
@@ -105,7 +98,7 @@ class TypeEnvironment { |
return element.computeType(compiler.resolution); |
} |
- DartType operator[] (String name) { |
+ DartType operator [](String name) { |
if (name == 'dynamic') return const DynamicType(); |
if (name == 'void') return const VoidType(); |
return getElementType(name); |
@@ -132,11 +125,9 @@ class TypeEnvironment { |
return compiler.types.flatten(T); |
} |
- FunctionType functionType(DartType returnType, |
- List<DartType> parameters, |
- {List<DartType> optionalParameters: |
- const <DartType>[], |
- Map<String,DartType> namedParameters}) { |
+ FunctionType functionType(DartType returnType, List<DartType> parameters, |
+ {List<DartType> optionalParameters: const <DartType>[], |
+ Map<String, DartType> namedParameters}) { |
List<String> namedParameterNames = <String>[]; |
List<DartType> namedParameterTypes = <DartType>[]; |
if (namedParameters != null) { |
@@ -145,8 +136,7 @@ class TypeEnvironment { |
namedParameterTypes.add(type); |
}); |
} |
- return new FunctionType.synthesized( |
- returnType, parameters, optionalParameters, |
- namedParameterNames, namedParameterTypes); |
+ return new FunctionType.synthesized(returnType, parameters, |
+ optionalParameters, namedParameterNames, namedParameterTypes); |
} |
} |