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/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 computeLibrarySourceErrors(source); | 994 computeLibrarySourceErrors(source); |
995 assertNoErrors(source); | 995 assertNoErrors(source); |
996 verify([source]); | 996 verify([source]); |
997 CompilationUnit unit = _getResolvedLibraryUnit(source); | 997 CompilationUnit unit = _getResolvedLibraryUnit(source); |
998 SimpleIdentifier ref = EngineTestCase.findNode( | 998 SimpleIdentifier ref = EngineTestCase.findNode( |
999 unit, code, "p]", (node) => node is SimpleIdentifier); | 999 unit, code, "p]", (node) => node is SimpleIdentifier); |
1000 EngineTestCase.assertInstanceOf( | 1000 EngineTestCase.assertInstanceOf( |
1001 (obj) => obj is ParameterElement, ParameterElement, ref.staticElement); | 1001 (obj) => obj is ParameterElement, ParameterElement, ref.staticElement); |
1002 } | 1002 } |
1003 | 1003 |
| 1004 void test_commentReference_beforeFunctionTypeAlias() { |
| 1005 String code = r''' |
| 1006 /// [p] |
| 1007 typedef Foo(int p); |
| 1008 '''; |
| 1009 Source source = addSource(code); |
| 1010 computeLibrarySourceErrors(source); |
| 1011 assertNoErrors(source); |
| 1012 verify([source]); |
| 1013 CompilationUnit unit = _getResolvedLibraryUnit(source); |
| 1014 SimpleIdentifier ref = EngineTestCase.findNode( |
| 1015 unit, code, "p]", (node) => node is SimpleIdentifier); |
| 1016 EngineTestCase.assertInstanceOf( |
| 1017 (obj) => obj is ParameterElement, ParameterElement, ref.staticElement); |
| 1018 } |
| 1019 |
| 1020 void test_commentReference_beforeGetter() { |
| 1021 String code = r''' |
| 1022 abstract class A { |
| 1023 /// [int] |
| 1024 get g => null; |
| 1025 }'''; |
| 1026 Source source = addSource(code); |
| 1027 computeLibrarySourceErrors(source); |
| 1028 assertNoErrors(source); |
| 1029 verify([source]); |
| 1030 CompilationUnit unit = _getResolvedLibraryUnit(source); |
| 1031 { |
| 1032 SimpleIdentifier ref = EngineTestCase.findNode( |
| 1033 unit, code, "int]", (node) => node is SimpleIdentifier); |
| 1034 expect(ref.staticElement, isNotNull); |
| 1035 } |
| 1036 } |
| 1037 |
1004 void test_commentReference_beforeMethod() { | 1038 void test_commentReference_beforeMethod() { |
1005 String code = r''' | 1039 String code = r''' |
1006 abstract class A { | 1040 abstract class A { |
1007 /// [p1] | 1041 /// [p1] |
1008 ma(int p1) {} | 1042 ma(int p1) {} |
1009 /// [p2] | 1043 /// [p2] |
1010 mb(int p2); | 1044 mb(int p2); |
1011 }'''; | 1045 }'''; |
1012 Source source = addSource(code); | 1046 Source source = addSource(code); |
1013 computeLibrarySourceErrors(source); | 1047 computeLibrarySourceErrors(source); |
(...skipping 4916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5930 reset(); | 5964 reset(); |
5931 } | 5965 } |
5932 | 5966 |
5933 void _check_wrongNumberOfParametersForOperator1(String name) { | 5967 void _check_wrongNumberOfParametersForOperator1(String name) { |
5934 _check_wrongNumberOfParametersForOperator(name, "a"); | 5968 _check_wrongNumberOfParametersForOperator(name, "a"); |
5935 } | 5969 } |
5936 | 5970 |
5937 CompilationUnit _getResolvedLibraryUnit(Source source) => | 5971 CompilationUnit _getResolvedLibraryUnit(Source source) => |
5938 analysisContext.getResolvedCompilationUnit2(source, source); | 5972 analysisContext.getResolvedCompilationUnit2(source, source); |
5939 } | 5973 } |
OLD | NEW |