OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 expect(edit.replacement, equalsIgnoringWhitespace('implements A, B')); | 1358 expect(edit.replacement, equalsIgnoringWhitespace('implements A, B')); |
1359 } | 1359 } |
1360 | 1360 |
1361 Future<Null> _assertImportLibraries( | 1361 Future<Null> _assertImportLibraries( |
1362 String initialCode, List<String> newUris, String expectedCode) async { | 1362 String initialCode, List<String> newUris, String expectedCode) async { |
1363 String path = provider.convertPath('/test.dart'); | 1363 String path = provider.convertPath('/test.dart'); |
1364 addSource(path, initialCode); | 1364 addSource(path, initialCode); |
1365 DartChangeBuilderImpl builder = new DartChangeBuilderImpl(driver); | 1365 DartChangeBuilderImpl builder = new DartChangeBuilderImpl(driver); |
1366 await builder.addFileEdit(path, 1, (DartFileEditBuilder builder) { | 1366 await builder.addFileEdit(path, 1, (DartFileEditBuilder builder) { |
1367 Iterable<_MockSource> sources = newUris.map((newUri) { | 1367 Iterable<_MockSource> sources = newUris.map((newUri) { |
1368 String path = newUri.contains(':') ? null : '/$newUri'; | 1368 String path = |
| 1369 newUri.contains(':') ? null : provider.convertPath('/$newUri'); |
1369 return new _MockSource(path, Uri.parse(newUri)); | 1370 return new _MockSource(path, Uri.parse(newUri)); |
1370 }); | 1371 }); |
1371 builder.importLibraries(sources); | 1372 builder.importLibraries(sources); |
1372 }); | 1373 }); |
1373 | 1374 |
1374 String resultCode = initialCode; | 1375 String resultCode = initialCode; |
1375 List<SourceEdit> edits = getEdits(builder); | 1376 List<SourceEdit> edits = getEdits(builder); |
1376 for (SourceEdit edit in edits) { | 1377 for (SourceEdit edit in edits) { |
1377 resultCode = edit.apply(resultCode); | 1378 resultCode = edit.apply(resultCode); |
1378 } | 1379 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 @override | 1486 @override |
1486 final String fullName; | 1487 final String fullName; |
1487 | 1488 |
1488 @override | 1489 @override |
1489 final Uri uri; | 1490 final Uri uri; |
1490 | 1491 |
1491 _MockSource(this.fullName, this.uri); | 1492 _MockSource(this.fullName, this.uri); |
1492 | 1493 |
1493 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 1494 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
1494 } | 1495 } |
OLD | NEW |