| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
| 6 import 'package:analysis_server/protocol/protocol_constants.dart'; | 6 import 'package:analysis_server/protocol/protocol_constants.dart'; |
| 7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 9 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }); | 62 }); |
| 63 fail('Expected an exception to be thrown'); | 63 fail('Expected an exception to be thrown'); |
| 64 } on RequestFailure catch (e) { | 64 } on RequestFailure catch (e) { |
| 65 expect(e.response.id, id); | 65 expect(e.response.id, id); |
| 66 expect(e.response.error.code, RequestErrorCode.INVALID_OVERLAY_CHANGE); | 66 expect(e.response.error.code, RequestErrorCode.INVALID_OVERLAY_CHANGE); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 test_multiple_contexts() async { | 70 test_multiple_contexts() async { |
| 71 String fooPath = '/project1/foo.dart'; | 71 String fooPath = '/project1/foo.dart'; |
| 72 resourceProvider.newFile( | 72 resourceProvider.newFile(fooPath, ''' |
| 73 fooPath, | |
| 74 ''' | |
| 75 library foo; | 73 library foo; |
| 76 import '../project2/baz.dart'; | 74 import '../project2/baz.dart'; |
| 77 main() { f(); }'''); | 75 main() { f(); }'''); |
| 78 String barPath = '/project2/bar.dart'; | 76 String barPath = '/project2/bar.dart'; |
| 79 resourceProvider.newFile( | 77 resourceProvider.newFile(barPath, ''' |
| 80 barPath, | |
| 81 ''' | |
| 82 library bar; | 78 library bar; |
| 83 import 'baz.dart'; | 79 import 'baz.dart'; |
| 84 main() { f(); }'''); | 80 main() { f(); }'''); |
| 85 String bazPath = '/project2/baz.dart'; | 81 String bazPath = '/project2/baz.dart'; |
| 86 resourceProvider.newFile( | 82 resourceProvider.newFile(bazPath, ''' |
| 87 bazPath, | |
| 88 ''' | |
| 89 library baz; | 83 library baz; |
| 90 f(int i) {} | 84 f(int i) {} |
| 91 '''); | 85 '''); |
| 92 Request request = | 86 Request request = |
| 93 new AnalysisSetAnalysisRootsParams(['/project1', '/project2'], []) | 87 new AnalysisSetAnalysisRootsParams(['/project1', '/project2'], []) |
| 94 .toRequest('0'); | 88 .toRequest('0'); |
| 95 handleSuccessfulRequest(request); | 89 handleSuccessfulRequest(request); |
| 96 { | 90 { |
| 97 await server.onAnalysisComplete; | 91 await server.onAnalysisComplete; |
| 98 // Files foo.dart and bar.dart should both have errors, since they both | 92 // Files foo.dart and bar.dart should both have errors, since they both |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 277 |
| 284 _ArgumentMatcher_CompilationUnit(this.file); | 278 _ArgumentMatcher_CompilationUnit(this.file); |
| 285 | 279 |
| 286 @override | 280 @override |
| 287 bool matches(arg) { | 281 bool matches(arg) { |
| 288 return arg is CompilationUnit && | 282 return arg is CompilationUnit && |
| 289 resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName == | 283 resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName == |
| 290 file; | 284 file; |
| 291 } | 285 } |
| 292 } | 286 } |
| OLD | NEW |