| OLD | NEW |
| 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("../../../lib/compiler/compiler.dart"); | 8 #import("../../../lib/compiler/compiler.dart"); |
| 9 #import("../../../lib/compiler/implementation/dart_backend/dart_backend.dart"); |
| 10 #import("../../../lib/compiler/implementation/elements/elements.dart"); |
| 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 11 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 9 | 12 |
| 10 testUnparse(String statement) { | 13 testUnparse(String statement) { |
| 11 Node node = parseStatement(statement); | 14 Node node = parseStatement(statement); |
| 12 Expect.equals(statement, node.unparse()); | 15 Expect.equals(statement, node.unparse()); |
| 13 } | 16 } |
| 14 | 17 |
| 15 testUnparseMember(String member) { | 18 testUnparseMember(String member) { |
| 16 Node node = parseMember(member); | 19 Node node = parseMember(member); |
| 17 Expect.equals(member, node.unparse()); | 20 Expect.equals(member, node.unparse()); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 'set topgetset(arg){}' | 442 'set topgetset(arg){}' |
| 440 'main(){topgetset; topgetset=6; p_topgetset; p_topgetset=5;}'; | 443 'main(){topgetset; topgetset=6; p_topgetset; p_topgetset=5;}'; |
| 441 testDart2DartWithLibrary(mainSrc, librarySrc, | 444 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 442 (String result) { Expect.equals(expectedResult, result); }); | 445 (String result) { Expect.equals(expectedResult, result); }); |
| 443 } | 446 } |
| 444 | 447 |
| 445 testFieldTypeOutput() { | 448 testFieldTypeOutput() { |
| 446 testDart2Dart('main(){new A().field;}class B{}class A{B field;}'); | 449 testDart2Dart('main(){new A().field;}class B{}class A{B field;}'); |
| 447 } | 450 } |
| 448 | 451 |
| 452 testDefaultClassNamePlaceholder() { |
| 453 var src = ''' |
| 454 interface I default C{ |
| 455 I(); |
| 456 } |
| 457 |
| 458 class C { |
| 459 I() {} |
| 460 } |
| 461 |
| 462 main() { |
| 463 new I(); |
| 464 } |
| 465 '''; |
| 466 MockCompiler compiler = new MockCompiler(); |
| 467 compiler.parseScript(src); |
| 468 ClassElement interfaceElement = compiler.mainApp.find(buildSourceString('I')); |
| 469 interfaceElement.ensureResolved(compiler); |
| 470 PlaceholderCollector collector = new PlaceholderCollector(compiler); |
| 471 collector.collect(interfaceElement, |
| 472 compiler.enqueuer.resolution.resolvedElements[interfaceElement]); |
| 473 ClassNode interfaceNode = interfaceElement.parseNode(compiler); |
| 474 Node defaultTypeNode = interfaceNode.defaultClause.typeName; |
| 475 ClassElement classElement = compiler.mainApp.find(buildSourceString('C')); |
| 476 // Check that 'C' in default clause of I gets into placeholders. |
| 477 Expect.isTrue(collector.elementNodes[classElement].contains(defaultTypeNode)); |
| 478 } |
| 479 |
| 449 main() { | 480 main() { |
| 450 testSignedConstants(); | 481 testSignedConstants(); |
| 451 testGenericTypes(); | 482 testGenericTypes(); |
| 452 testForLoop(); | 483 testForLoop(); |
| 453 testEmptyList(); | 484 testEmptyList(); |
| 454 testClosure(); | 485 testClosure(); |
| 455 testIndexedOperatorDecl(); | 486 testIndexedOperatorDecl(); |
| 456 testNativeMethods(); | 487 testNativeMethods(); |
| 457 testPrefixIncrements(); | 488 testPrefixIncrements(); |
| 458 testConstModifier(); | 489 testConstModifier(); |
| 459 testSimpleFileUnparse(); | 490 testSimpleFileUnparse(); |
| 460 testTopLevelField(); | 491 testTopLevelField(); |
| 461 testSimpleObjectInstantiation(); | 492 testSimpleObjectInstantiation(); |
| 462 testSimpleTopLevelClass(); | 493 testSimpleTopLevelClass(); |
| 463 testClassWithSynthesizedConstructor(); | 494 testClassWithSynthesizedConstructor(); |
| 464 testClassWithMethod(); | 495 testClassWithMethod(); |
| 465 testExtendsImplements(); | 496 testExtendsImplements(); |
| 466 testVariableDefinitions(); | 497 testVariableDefinitions(); |
| 467 testGetSet(); | 498 testGetSet(); |
| 468 testFactoryConstructor(); | 499 testFactoryConstructor(); |
| 469 testAbstractClass(); | 500 testAbstractClass(); |
| 470 //testConflictSendsRename(); | 501 //testConflictSendsRename(); |
| 471 testNoConflictSendsRename(); | 502 testNoConflictSendsRename(); |
| 472 testConflictLibraryClassRename(); | 503 testConflictLibraryClassRename(); |
| 473 testDefaultClassWithArgs(); | 504 testDefaultClassWithArgs(); |
| 474 testClassExtendsWithArgs(); | 505 testClassExtendsWithArgs(); |
| 475 testStaticInvocation(); | 506 testStaticInvocation(); |
| 476 testLibraryGetSet(); | 507 testLibraryGetSet(); |
| 477 testFieldTypeOutput(); | 508 testFieldTypeOutput(); |
| 509 testDefaultClassNamePlaceholder(); |
| 478 } | 510 } |
| OLD | NEW |