| 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 engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 '''); | 2223 '''); |
| 2224 _updateAndValidate(r''' | 2224 _updateAndValidate(r''' |
| 2225 /** | 2225 /** |
| 2226 * aaa bbbb | 2226 * aaa bbbb |
| 2227 */ | 2227 */ |
| 2228 main() { | 2228 main() { |
| 2229 } | 2229 } |
| 2230 '''); | 2230 '''); |
| 2231 } | 2231 } |
| 2232 | 2232 |
| 2233 void test_dartDoc_clumsy_updateText() { | 2233 void test_dartDoc_clumsy_updateText_beforeKeywordToken() { |
| 2234 _resolveUnit(r''' |
| 2235 /** |
| 2236 * A comment with the [int] type reference. |
| 2237 */ |
| 2238 class A {} |
| 2239 '''); |
| 2240 _updateAndValidate(r''' |
| 2241 /** |
| 2242 * A comment with the [int] type reference. |
| 2243 * Plus reference to [A] itself. |
| 2244 */ |
| 2245 class A {} |
| 2246 '''); |
| 2247 } |
| 2248 |
| 2249 void test_dartDoc_clumsy_updateText_insert() { |
| 2234 _resolveUnit(r''' | 2250 _resolveUnit(r''' |
| 2235 /** | 2251 /** |
| 2236 * A function [main] with a parameter [p] of type [int]. | 2252 * A function [main] with a parameter [p] of type [int]. |
| 2237 */ | 2253 */ |
| 2238 main(int p) { | 2254 main(int p) { |
| 2239 } | 2255 } |
| 2240 /** | 2256 /** |
| 2241 * Other comment. | 2257 * Other comment with [int] reference. |
| 2242 */ | 2258 */ |
| 2243 foo() {} | 2259 foo() {} |
| 2244 '''); | 2260 '''); |
| 2245 _updateAndValidate(r''' | 2261 _updateAndValidate(r''' |
| 2246 /** | 2262 /** |
| 2247 * A function [main] with a parameter [p] of type [int]. | 2263 * A function [main] with a parameter [p] of type [int]. |
| 2248 * Updated. | 2264 * Inserted text with [String] reference. |
| 2249 */ | 2265 */ |
| 2250 main(int p) { | 2266 main(int p) { |
| 2251 } | 2267 } |
| 2252 /** | 2268 /** |
| 2253 * Other comment. | 2269 * Other comment with [int] reference. |
| 2254 */ | 2270 */ |
| 2255 foo() {} | 2271 foo() {} |
| 2256 '''); | 2272 '''); |
| 2257 } | 2273 } |
| 2258 | 2274 |
| 2259 void test_dartDoc_clumsy_updateText_beforeKeywordToken() { | 2275 void test_dartDoc_clumsy_updateText_remove() { |
| 2260 _resolveUnit(r''' | 2276 _resolveUnit(r''' |
| 2261 /** | 2277 /** |
| 2262 * A comment with the [int] type reference. | 2278 * A function [main] with a parameter [p] of type [int]. |
| 2279 * Some text with [String] reference to remove. |
| 2263 */ | 2280 */ |
| 2264 class A {} | 2281 main(int p) { |
| 2282 } |
| 2283 /** |
| 2284 * Other comment with [int] reference. |
| 2285 */ |
| 2286 foo() {} |
| 2265 '''); | 2287 '''); |
| 2266 _updateAndValidate(r''' | 2288 _updateAndValidate(r''' |
| 2267 /** | 2289 /** |
| 2268 * A comment with the [int] type reference. | 2290 * A function [main] with a parameter [p] of type [int]. |
| 2269 * Plus reference to [A] itself. | |
| 2270 */ | 2291 */ |
| 2271 class A {} | 2292 main(int p) { |
| 2293 } |
| 2294 /** |
| 2295 * Other comment with [int] reference. |
| 2296 */ |
| 2297 foo() {} |
| 2272 '''); | 2298 '''); |
| 2273 } | 2299 } |
| 2274 | 2300 |
| 2275 void test_dartDoc_elegant_addReference() { | 2301 void test_dartDoc_elegant_addReference() { |
| 2276 _resolveUnit(r''' | 2302 _resolveUnit(r''' |
| 2277 /// aaa bbb | 2303 /// aaa bbb |
| 2278 main() { | 2304 main() { |
| 2279 return 1; | 2305 return 1; |
| 2280 } | 2306 } |
| 2281 '''); | 2307 '''); |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3839 for (int i = 0; i < length; i++) { | 3865 for (int i = 0; i < length; i++) { |
| 3840 _visitNode(nodeList[i], otherList[i]); | 3866 _visitNode(nodeList[i], otherList[i]); |
| 3841 } | 3867 } |
| 3842 } | 3868 } |
| 3843 | 3869 |
| 3844 void _visitNode(AstNode node, AstNode other) { | 3870 void _visitNode(AstNode node, AstNode other) { |
| 3845 if (node == null) { | 3871 if (node == null) { |
| 3846 expect(other, isNull); | 3872 expect(other, isNull); |
| 3847 } else { | 3873 } else { |
| 3848 this.other = other; | 3874 this.other = other; |
| 3875 expect(node.offset, other.offset); |
| 3876 expect(node.length, other.length); |
| 3849 node.accept(this); | 3877 node.accept(this); |
| 3850 } | 3878 } |
| 3851 } | 3879 } |
| 3852 | 3880 |
| 3853 void _visitNormalFormalParameter(NormalFormalParameter node, | 3881 void _visitNormalFormalParameter(NormalFormalParameter node, |
| 3854 NormalFormalParameter other) { | 3882 NormalFormalParameter other) { |
| 3855 _verifyElement(node.element, other.element); | 3883 _verifyElement(node.element, other.element); |
| 3856 _visitNode(node.documentationComment, other.documentationComment); | 3884 _visitNode(node.documentationComment, other.documentationComment); |
| 3857 _visitList(node.metadata, other.metadata); | 3885 _visitList(node.metadata, other.metadata); |
| 3858 _visitNode(node.identifier, other.identifier); | 3886 _visitNode(node.identifier, other.identifier); |
| 3859 } | 3887 } |
| 3860 | 3888 |
| 3861 static void assertSameResolution(CompilationUnit actual, | 3889 static void assertSameResolution(CompilationUnit actual, |
| 3862 CompilationUnit expected) { | 3890 CompilationUnit expected) { |
| 3863 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 3891 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 3864 actual.accept(validator); | 3892 actual.accept(validator); |
| 3865 } | 3893 } |
| 3866 } | 3894 } |
| OLD | NEW |