| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.test.generated.non_error_resolver_test; | 5 library analyzer.test.generated.non_error_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
| 10 import 'package:analyzer/src/error/codes.dart'; | 10 import 'package:analyzer/src/error/codes.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 Source source = addSource(r''' | 29 Source source = addSource(r''' |
| 30 enum E { ONE } | 30 enum E { ONE } |
| 31 E e() { | 31 E e() { |
| 32 return E.TWO; | 32 return E.TWO; |
| 33 }'''); | 33 }'''); |
| 34 computeLibrarySourceErrors(source); | 34 computeLibrarySourceErrors(source); |
| 35 assertNoErrors(source); | 35 assertNoErrors(source); |
| 36 verify([source]); | 36 verify([source]); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void |
| 40 test_abstractSuperMemberReference_superHasConcrete_mixinHasAbstract_method
() { |
| 41 Source source = addSource(''' |
| 42 class A { |
| 43 void method() {} |
| 44 } |
| 45 |
| 46 abstract class B { |
| 47 void method(); |
| 48 } |
| 49 |
| 50 class C extends A with B { |
| 51 void method() { |
| 52 super.method(); |
| 53 } |
| 54 } |
| 55 '''); |
| 56 computeLibrarySourceErrors(source); |
| 57 assertNoErrors(source); |
| 58 verify([source]); |
| 59 } |
| 60 |
| 39 void test_abstractSuperMemberReference_superHasNoSuchMethod() { | 61 void test_abstractSuperMemberReference_superHasNoSuchMethod() { |
| 40 Source source = addSource(''' | 62 Source source = addSource(''' |
| 41 abstract class A { | 63 abstract class A { |
| 42 int m(); | 64 int m(); |
| 43 noSuchMethod(_) => 42; | 65 noSuchMethod(_) => 42; |
| 44 } | 66 } |
| 45 | 67 |
| 46 class B extends A { | 68 class B extends A { |
| 47 int m() => super.m(); | 69 int m() => super.m(); |
| 48 } | 70 } |
| (...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3711 Source source = addSource(r''' | 3733 Source source = addSource(r''' |
| 3712 class A {} | 3734 class A {} |
| 3713 class B extends A { | 3735 class B extends A { |
| 3714 B() : super() {} | 3736 B() : super() {} |
| 3715 }'''); | 3737 }'''); |
| 3716 computeLibrarySourceErrors(source); | 3738 computeLibrarySourceErrors(source); |
| 3717 assertNoErrors(source); | 3739 assertNoErrors(source); |
| 3718 verify([source]); | 3740 verify([source]); |
| 3719 } | 3741 } |
| 3720 | 3742 |
| 3721 void test_nativeFunctionBodyInNonSDKCode_function() { | |
| 3722 Source source = addSource(r''' | |
| 3723 import 'dart-ext:x'; | |
| 3724 int m(a) native 'string';'''); | |
| 3725 computeLibrarySourceErrors(source); | |
| 3726 assertNoErrors(source); | |
| 3727 // Cannot verify the AST because the import's URI cannot be resolved. | |
| 3728 } | |
| 3729 | |
| 3730 void test_nativeConstConstructor() { | 3743 void test_nativeConstConstructor() { |
| 3731 Source source = addSource(r''' | 3744 Source source = addSource(r''' |
| 3732 import 'dart-ext:x'; | 3745 import 'dart-ext:x'; |
| 3733 class Foo { | 3746 class Foo { |
| 3734 const Foo() native 'Foo_Foo'; | 3747 const Foo() native 'Foo_Foo'; |
| 3735 const factory Foo.foo() native 'Foo_Foo_foo'; | 3748 const factory Foo.foo() native 'Foo_Foo_foo'; |
| 3736 }'''); | 3749 }'''); |
| 3737 computeLibrarySourceErrors(source); | 3750 computeLibrarySourceErrors(source); |
| 3738 assertNoErrors(source); | 3751 assertNoErrors(source); |
| 3739 // Cannot verify the AST because the import's URI cannot be resolved. | 3752 // Cannot verify the AST because the import's URI cannot be resolved. |
| 3753 } |
| 3754 |
| 3755 void test_nativeFunctionBodyInNonSDKCode_function() { |
| 3756 Source source = addSource(r''' |
| 3757 import 'dart-ext:x'; |
| 3758 int m(a) native 'string';'''); |
| 3759 computeLibrarySourceErrors(source); |
| 3760 assertNoErrors(source); |
| 3761 // Cannot verify the AST because the import's URI cannot be resolved. |
| 3740 } | 3762 } |
| 3741 | 3763 |
| 3742 void test_newWithAbstractClass_factory() { | 3764 void test_newWithAbstractClass_factory() { |
| 3743 Source source = addSource(r''' | 3765 Source source = addSource(r''' |
| 3744 abstract class A { | 3766 abstract class A { |
| 3745 factory A() { return new B(); } | 3767 factory A() { return new B(); } |
| 3746 } | 3768 } |
| 3747 class B implements A { | 3769 class B implements A { |
| 3748 B() {} | 3770 B() {} |
| 3749 } | 3771 } |
| (...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6239 reset(); | 6261 reset(); |
| 6240 } | 6262 } |
| 6241 | 6263 |
| 6242 void _check_wrongNumberOfParametersForOperator1(String name) { | 6264 void _check_wrongNumberOfParametersForOperator1(String name) { |
| 6243 _check_wrongNumberOfParametersForOperator(name, "a"); | 6265 _check_wrongNumberOfParametersForOperator(name, "a"); |
| 6244 } | 6266 } |
| 6245 | 6267 |
| 6246 CompilationUnit _getResolvedLibraryUnit(Source source) => | 6268 CompilationUnit _getResolvedLibraryUnit(Source source) => |
| 6247 analysisContext.getResolvedCompilationUnit2(source, source); | 6269 analysisContext.getResolvedCompilationUnit2(source, source); |
| 6248 } | 6270 } |
| OLD | NEW |