OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 Source source = addSource(createSource(// | 538 Source source = addSource(createSource(// |
539 "class A {", | 539 "class A {", |
540 " final int x;", | 540 " final int x;", |
541 " A() : x = 0 {}", | 541 " A() : x = 0 {}", |
542 "}")); | 542 "}")); |
543 resolve(source); | 543 resolve(source); |
544 assertNoErrors(); | 544 assertNoErrors(); |
545 verify(source); | 545 verify(source); |
546 } | 546 } |
547 | 547 |
| 548 public void test_implicitThisReferenceInInitializer_constructorName() throws E
xception { |
| 549 Source source = addSource(createSource(// |
| 550 "class A {", |
| 551 " A.named() {}", |
| 552 "}", |
| 553 "class B {", |
| 554 " var v;", |
| 555 " B() : v = new A.named();", |
| 556 "}")); |
| 557 resolve(source); |
| 558 assertNoErrors(); |
| 559 verify(source); |
| 560 } |
| 561 |
| 562 public void test_implicitThisReferenceInInitializer_prefixedIdentifier() throw
s Exception { |
| 563 Source source = addSource(createSource(// |
| 564 "class A {", |
| 565 " var f;", |
| 566 "}", |
| 567 "class B {", |
| 568 " var v;", |
| 569 " B(A a) : v = a.f;", |
| 570 "}")); |
| 571 resolve(source); |
| 572 assertNoErrors(); |
| 573 verify(source); |
| 574 } |
| 575 |
| 576 public void test_implicitThisReferenceInInitializer_qualifiedMethodInvocation(
) throws Exception { |
| 577 Source source = addSource(createSource(// |
| 578 "class A {", |
| 579 " f() {}", |
| 580 "}", |
| 581 "class B {", |
| 582 " var v;", |
| 583 " B() : v = new A().f();", |
| 584 "}")); |
| 585 resolve(source); |
| 586 assertNoErrors(); |
| 587 verify(source); |
| 588 } |
| 589 |
| 590 public void test_implicitThisReferenceInInitializer_qualifiedPropertyAccess()
throws Exception { |
| 591 Source source = addSource(createSource(// |
| 592 "class A {", |
| 593 " var f;", |
| 594 "}", |
| 595 "class B {", |
| 596 " var v;", |
| 597 " B() : v = new A().f;", |
| 598 "}")); |
| 599 resolve(source); |
| 600 assertNoErrors(); |
| 601 verify(source); |
| 602 } |
| 603 |
| 604 public void test_implicitThisReferenceInInitializer_staticField_superClass() t
hrows Exception { |
| 605 Source source = addSource(createSource(// |
| 606 "class A {", |
| 607 " static var f;", |
| 608 "}", |
| 609 "class B extends A {", |
| 610 " var v;", |
| 611 " B() : v = f;", |
| 612 "}")); |
| 613 resolve(source); |
| 614 assertNoErrors(); |
| 615 verify(source); |
| 616 } |
| 617 |
| 618 public void test_implicitThisReferenceInInitializer_staticField_thisClass() th
rows Exception { |
| 619 Source source = addSource(createSource(// |
| 620 "class A {", |
| 621 " var v;", |
| 622 " A() : v = f;", |
| 623 " static var f;", |
| 624 "}")); |
| 625 resolve(source); |
| 626 assertNoErrors(); |
| 627 verify(source); |
| 628 } |
| 629 |
| 630 public void test_implicitThisReferenceInInitializer_staticGetter() throws Exce
ption { |
| 631 Source source = addSource(createSource(// |
| 632 "class A {", |
| 633 " var v;", |
| 634 " A() : v = f;", |
| 635 " static get f => 42;", |
| 636 "}")); |
| 637 resolve(source); |
| 638 assertNoErrors(); |
| 639 verify(source); |
| 640 } |
| 641 |
| 642 public void test_implicitThisReferenceInInitializer_staticMethod() throws Exce
ption { |
| 643 Source source = addSource(createSource(// |
| 644 "class A {", |
| 645 " var v;", |
| 646 " A() : v = f();", |
| 647 " static f() => 42;", |
| 648 "}")); |
| 649 resolve(source); |
| 650 assertNoErrors(); |
| 651 verify(source); |
| 652 } |
| 653 |
| 654 public void test_implicitThisReferenceInInitializer_topLevelField() throws Exc
eption { |
| 655 Source source = addSource(createSource(// |
| 656 "class A {", |
| 657 " var v;", |
| 658 " A() : v = f;", |
| 659 "}", |
| 660 "var f = 42;")); |
| 661 resolve(source); |
| 662 assertNoErrors(); |
| 663 verify(source); |
| 664 } |
| 665 |
| 666 public void test_implicitThisReferenceInInitializer_topLevelFunction() throws
Exception { |
| 667 Source source = addSource(createSource(// |
| 668 "class A {", |
| 669 " var v;", |
| 670 " A() : v = f();", |
| 671 "}", |
| 672 "f() => 42;")); |
| 673 resolve(source); |
| 674 assertNoErrors(); |
| 675 verify(source); |
| 676 } |
| 677 |
| 678 public void test_implicitThisReferenceInInitializer_topLevelGetter() throws Ex
ception { |
| 679 Source source = addSource(createSource(// |
| 680 "class A {", |
| 681 " var v;", |
| 682 " A() : v = f;", |
| 683 "}", |
| 684 "get f = >42;")); |
| 685 resolve(source); |
| 686 assertNoErrors(); |
| 687 verify(source); |
| 688 } |
| 689 |
| 690 public void test_implicitThisReferenceInInitializer_typeVariable() throws Exce
ption { |
| 691 Source source = addSource(createSource(// |
| 692 "class A<T> {", |
| 693 " var v;", |
| 694 " A(p) : v = (p is T);", |
| 695 "}")); |
| 696 resolve(source); |
| 697 assertNoErrors(); |
| 698 verify(source); |
| 699 } |
| 700 |
548 public void test_importDuplicatedLibraryName() throws Exception { | 701 public void test_importDuplicatedLibraryName() throws Exception { |
549 Source source = addSource(createSource(// | 702 Source source = addSource(createSource(// |
550 "library test;", | 703 "library test;", |
551 "import 'lib.dart';", | 704 "import 'lib.dart';", |
552 "import 'lib.dart';")); | 705 "import 'lib.dart';")); |
553 addSource("/lib.dart", "library lib;"); | 706 addSource("/lib.dart", "library lib;"); |
554 resolve(source); | 707 resolve(source); |
555 assertNoErrors(); | 708 assertNoErrors(); |
556 verify(source); | 709 verify(source); |
557 } | 710 } |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 resolve(source); | 1880 resolve(source); |
1728 assertNoErrors(); | 1881 assertNoErrors(); |
1729 verify(source); | 1882 verify(source); |
1730 reset(); | 1883 reset(); |
1731 } | 1884 } |
1732 | 1885 |
1733 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { | 1886 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { |
1734 check_wrongNumberOfParametersForOperator(name, "a"); | 1887 check_wrongNumberOfParametersForOperator(name, "a"); |
1735 } | 1888 } |
1736 } | 1889 } |
OLD | NEW |