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

Side by Side Diff: tests/compiler/dart2js/unparser_test.dart

Issue 10828390: dart2dart Fix factory for interfaces renames (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:uri'); 5 #import('dart:uri');
6 #import('parser_helper.dart'); 6 #import('parser_helper.dart');
7 #import('mock_compiler.dart'); 7 #import('mock_compiler.dart');
8 #import("../../../lib/compiler/compiler.dart"); 8 #import("../../../lib/compiler/compiler.dart");
9 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); 9 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart");
10 #import("../../../lib/compiler/implementation/elements/elements.dart"); 10 #import("../../../lib/compiler/implementation/elements/elements.dart");
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 PlaceholderCollector collector = new PlaceholderCollector(compiler); 470 PlaceholderCollector collector = new PlaceholderCollector(compiler);
471 collector.collect(interfaceElement, 471 collector.collect(interfaceElement,
472 compiler.enqueuer.resolution.resolvedElements[interfaceElement]); 472 compiler.enqueuer.resolution.resolvedElements[interfaceElement]);
473 ClassNode interfaceNode = interfaceElement.parseNode(compiler); 473 ClassNode interfaceNode = interfaceElement.parseNode(compiler);
474 Node defaultTypeNode = interfaceNode.defaultClause.typeName; 474 Node defaultTypeNode = interfaceNode.defaultClause.typeName;
475 ClassElement classElement = compiler.mainApp.find(buildSourceString('C')); 475 ClassElement classElement = compiler.mainApp.find(buildSourceString('C'));
476 // Check that 'C' in default clause of I gets into placeholders. 476 // Check that 'C' in default clause of I gets into placeholders.
477 Expect.isTrue(collector.elementNodes[classElement].contains(defaultTypeNode)); 477 Expect.isTrue(collector.elementNodes[classElement].contains(defaultTypeNode));
478 } 478 }
479 479
480 testFactoryRename() {
481 var librarySrc = '''
482 #library('mylib');
483
484 interface I default B { I(); }
485 class A implements I { A() {} }
486 class B { factory I() {} }
487
488 ''';
489 var mainSrc = '''
490 #import('mylib.dart', prefix: 'mylib');
491
492 interface I default B { I(); }
493 class A implements I { A() {} }
494 class B { factory I() {} }
495
496 main() {
497 new I();
498 new A();
499
500 new mylib.I();
501 new mylib.A();
502 }
503 ''';
504 var expectedResult =
505 'interface p_I default B{p_I();}'
506 'class A implements p_I{A(){}}'
507 'class B{factory p_I(){}}'
508 'interface I default p_B{I();}'
509 'class p_A implements I{p_A(){}}'
510 'class p_B{factory I(){}}'
511 'main(){new I(); new p_A(); new p_I(); new A();}';
512 testDart2DartWithLibrary(mainSrc, librarySrc,
513 (String result) { Expect.equals(expectedResult, result); });
514 }
515
480 main() { 516 main() {
481 testSignedConstants(); 517 testSignedConstants();
482 testGenericTypes(); 518 testGenericTypes();
483 testForLoop(); 519 testForLoop();
484 testEmptyList(); 520 testEmptyList();
485 testClosure(); 521 testClosure();
486 testIndexedOperatorDecl(); 522 testIndexedOperatorDecl();
487 testNativeMethods(); 523 testNativeMethods();
488 testPrefixIncrements(); 524 testPrefixIncrements();
489 testConstModifier(); 525 testConstModifier();
(...skipping 10 matching lines...) Expand all
500 testAbstractClass(); 536 testAbstractClass();
501 //testConflictSendsRename(); 537 //testConflictSendsRename();
502 testNoConflictSendsRename(); 538 testNoConflictSendsRename();
503 testConflictLibraryClassRename(); 539 testConflictLibraryClassRename();
504 testDefaultClassWithArgs(); 540 testDefaultClassWithArgs();
505 testClassExtendsWithArgs(); 541 testClassExtendsWithArgs();
506 testStaticInvocation(); 542 testStaticInvocation();
507 // testLibraryGetSet(); // http://dartbug.com/4604 543 // testLibraryGetSet(); // http://dartbug.com/4604
508 testFieldTypeOutput(); 544 testFieldTypeOutput();
509 testDefaultClassNamePlaceholder(); 545 testDefaultClassNamePlaceholder();
546 testFactoryRename();
510 } 547 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698