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

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

Issue 10854218: dart2dart Collect type placeholder for default class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/compiler/implementation/dart_backend/placeholder_collector.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/unparser_test.dart
diff --git a/tests/compiler/dart2js/unparser_test.dart b/tests/compiler/dart2js/unparser_test.dart
index c3b2ab8ba71ea68a338cda75e795104ef33dbf00..f1fae74381c18136032c0a8797d7d951c7f3f0df 100644
--- a/tests/compiler/dart2js/unparser_test.dart
+++ b/tests/compiler/dart2js/unparser_test.dart
@@ -4,7 +4,10 @@
#import('dart:uri');
#import('parser_helper.dart');
+#import('mock_compiler.dart');
#import("../../../lib/compiler/compiler.dart");
+#import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart");
+#import("../../../lib/compiler/implementation/elements/elements.dart");
#import("../../../lib/compiler/implementation/tree/tree.dart");
testUnparse(String statement) {
@@ -446,6 +449,34 @@ testFieldTypeOutput() {
testDart2Dart('main(){new A().field;}class B{}class A{B field;}');
}
+testDefaultClassNamePlaceholder() {
+ var src = '''
+interface I default C{
+ I();
+}
+
+class C {
+ I() {}
+}
+
+main() {
+ new I();
+}
+''';
+ MockCompiler compiler = new MockCompiler();
+ compiler.parseScript(src);
+ ClassElement interfaceElement = compiler.mainApp.find(buildSourceString('I'));
+ interfaceElement.ensureResolved(compiler);
+ PlaceholderCollector collector = new PlaceholderCollector(compiler);
+ collector.collect(interfaceElement,
+ compiler.enqueuer.resolution.resolvedElements[interfaceElement]);
+ ClassNode interfaceNode = interfaceElement.parseNode(compiler);
+ Node defaultTypeNode = interfaceNode.defaultClause.typeName;
+ ClassElement classElement = compiler.mainApp.find(buildSourceString('C'));
+ // Check that 'C' in default clause of I gets into placeholders.
+ Expect.isTrue(collector.elementNodes[classElement].contains(defaultTypeNode));
+}
+
main() {
testSignedConstants();
testGenericTypes();
@@ -475,4 +506,5 @@ main() {
testStaticInvocation();
testLibraryGetSet();
testFieldTypeOutput();
+ testDefaultClassNamePlaceholder();
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/placeholder_collector.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698