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

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

Issue 137893024: Revert "Reapply "Implement new model for class members." and "Implement new model for interface mem… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « tests/compiler/dart2js/package_root_test.dart ('k') | tests/language/cyclic_metadata_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b64cecbe782b8b13c2fd8976cf03222cf149a004..01e8c16fad5869ffd0075d015e758555509aa74a 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -5,18 +5,9 @@
library type_test_helper;
import 'dart:async';
-import 'package:expect/expect.dart';
-import 'compiler_helper.dart' as mock;
-import 'memory_compiler.dart' as memory;
+import "package:expect/expect.dart";
import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
- show Compiler;
-import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
- show Element,
- TypeDeclarationElement,
- ClassElement;
-import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'
- show Link, LinkBuilder;
+import "compiler_helper.dart";
GenericType instantiate(TypeDeclarationElement element,
List<DartType> arguments) {
@@ -29,56 +20,35 @@ GenericType instantiate(TypeDeclarationElement element,
}
class TypeEnvironment {
- final Compiler compiler;
+ final MockCompiler compiler;
static Future<TypeEnvironment> create(
- String source, {bool useMockCompiler: true,
- bool expectNoErrors: false,
+ String source, {bool expectNoErrors: false,
bool expectNoWarningsOrErrors: false}) {
- Uri uri;
- Function getErrors;
- Function getWarnings;
- Compiler compiler;
- if (useMockCompiler) {
- uri = new Uri(scheme: 'source');
- mock.MockCompiler mockCompiler = mock.compilerFor('''
- main() {}
- $source''',
- uri,
- analyzeAll: true,
- analyzeOnly: true);
- getErrors = () => mockCompiler.errors;
- getWarnings = () => mockCompiler.warnings;
- compiler = mockCompiler;
- } else {
- memory.DiagnosticCollector collector = new memory.DiagnosticCollector();
- uri = Uri.parse('memory:main.dart');
- compiler = memory.compilerFor(
- {'main.dart': source},
- diagnosticHandler: collector,
- options: ['--analyze-all', '--analyze-only']);
- getErrors = () => collector.errors;
- getWarnings = () => collector.warnings;
- }
+ var uri = new Uri(scheme: 'source');
+ MockCompiler compiler = compilerFor('''
+ main() {}
+ $source''',
+ uri,
+ analyzeAll: true,
+ analyzeOnly: true);
return compiler.runCompiler(uri).then((_) {
if (expectNoErrors || expectNoWarningsOrErrors) {
- var errors = getErrors();
- Expect.isTrue(errors.isEmpty,
- 'Unexpected errors: ${errors}');
+ Expect.isTrue(compiler.errors.isEmpty,
+ 'Unexpected errors: ${compiler.errors}');
}
if (expectNoWarningsOrErrors) {
- var warnings = getWarnings();
- Expect.isTrue(warnings.isEmpty,
- 'Unexpected warnings: ${warnings}');
+ Expect.isTrue(compiler.warnings.isEmpty,
+ 'Unexpected warnings: ${compiler.warnings}');
}
return new TypeEnvironment._(compiler);
});
}
- TypeEnvironment._(Compiler this.compiler);
+ TypeEnvironment._(MockCompiler this.compiler);
Element getElement(String name) {
- var element = compiler.mainApp.find(name);
+ var element = findElement(compiler, name);
Expect.isNotNull(element);
if (element.isClass()) {
element.ensureResolved(compiler);
@@ -117,12 +87,12 @@ class TypeEnvironment {
FunctionType functionType(DartType returnType,
List<DartType> parameters,
- {List<DartType> optionalParameters,
+ {List<DartType> optionalParameter,
Map<String,DartType> namedParameters}) {
Link<DartType> parameterTypes =
new Link<DartType>.fromList(parameters);
- Link<DartType> optionalParameterTypes = optionalParameters != null
- ? new Link<DartType>.fromList(optionalParameters)
+ Link<DartType> optionalParameterTypes = optionalParameter != null
+ ? new Link<DartType>.fromList(optionalParameter)
: const Link<DartType>();
var namedParameterNames = new LinkBuilder<String>();
var namedParameterTypes = new LinkBuilder<DartType>();
« no previous file with comments | « tests/compiler/dart2js/package_root_test.dart ('k') | tests/language/cyclic_metadata_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698