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

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

Issue 12079094: Take type arguments into account in interface type subtype check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 10 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/type_substitution_test.dart ('k') | tests/language/language_dart2js.status » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..94faaced6fc73d986ecabb64dd008ee8fa42094c
--- /dev/null
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library type_test_helper;
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
+import "compiler_helper.dart";
+
+InterfaceType instantiate(ClassElement element, List<DartType> arguments) {
+ return new InterfaceType(element, new Link<DartType>.fromList(arguments));
+}
+
+class TypeEnvironment {
+ final MockCompiler compiler;
+
+ factory TypeEnvironment(String source) {
+ var uri = new Uri.fromComponents(scheme: 'source');
+ MockCompiler compiler = compilerFor('''
+ main() {}
+ $source''',
+ uri);
+ compiler.runCompiler(uri);
+ return new TypeEnvironment._(compiler);
+ }
+
+ TypeEnvironment._(MockCompiler this.compiler);
+
+ Element getElement(String name) {
+ var element = findElement(compiler, name);
+ Expect.isNotNull(element);
+ if (identical(element.kind, ElementKind.CLASS)) {
+ element.ensureResolved(compiler);
+ }
+ return element;
+ }
+
+ DartType getElementType(String name) {
+ return getElement(name).computeType(compiler);
+ }
+
+ DartType operator[] (String name) {
+ if (name == 'dynamic') return compiler.types.dynamicType;
+ return getElementType(name);
+ }
+
+ bool isSubtype(DartType T, DartType S) {
+ return compiler.types.isSubtype(T, S);
+ }
+}
« no previous file with comments | « tests/compiler/dart2js/type_substitution_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698