| 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 analysis_server.src.services.correction.fix_internal; | 5 library analysis_server.src.services.correction.fix_internal; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 import 'package:analyzer/src/generated/ast.dart'; | 28 import 'package:analyzer/src/generated/ast.dart'; |
| 29 import 'package:analyzer/src/generated/element.dart'; | 29 import 'package:analyzer/src/generated/element.dart'; |
| 30 import 'package:analyzer/src/generated/engine.dart'; | 30 import 'package:analyzer/src/generated/engine.dart'; |
| 31 import 'package:analyzer/src/generated/error.dart'; | 31 import 'package:analyzer/src/generated/error.dart'; |
| 32 import 'package:analyzer/src/generated/java_core.dart'; | 32 import 'package:analyzer/src/generated/java_core.dart'; |
| 33 import 'package:analyzer/src/generated/parser.dart'; | 33 import 'package:analyzer/src/generated/parser.dart'; |
| 34 import 'package:analyzer/src/generated/scanner.dart'; | 34 import 'package:analyzer/src/generated/scanner.dart'; |
| 35 import 'package:analyzer/src/generated/sdk.dart'; | 35 import 'package:analyzer/src/generated/sdk.dart'; |
| 36 import 'package:analyzer/src/generated/source.dart'; | 36 import 'package:analyzer/src/generated/source.dart'; |
| 37 import 'package:analyzer/src/generated/utilities_dart.dart'; | 37 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 38 import 'package:analyzer/src/task/dart.dart'; |
| 38 import 'package:path/path.dart'; | 39 import 'package:path/path.dart'; |
| 39 | 40 |
| 40 /** | 41 /** |
| 41 * A predicate is a one-argument function that returns a boolean value. | 42 * A predicate is a one-argument function that returns a boolean value. |
| 42 */ | 43 */ |
| 43 typedef bool ElementPredicate(Element argument); | 44 typedef bool ElementPredicate(Element argument); |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * The implementation of [DartFixContext]. | 47 * The implementation of [DartFixContext]. |
| 47 * | 48 * |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 { | 1445 { |
| 1445 DartSdk sdk = context.sourceFactory.dartSdk; | 1446 DartSdk sdk = context.sourceFactory.dartSdk; |
| 1446 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; | 1447 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; |
| 1447 for (SdkLibrary sdkLibrary in sdkLibraries) { | 1448 for (SdkLibrary sdkLibrary in sdkLibraries) { |
| 1448 SourceFactory sdkSourceFactory = context.sourceFactory; | 1449 SourceFactory sdkSourceFactory = context.sourceFactory; |
| 1449 String libraryUri = sdkLibrary.shortName; | 1450 String libraryUri = sdkLibrary.shortName; |
| 1450 Source librarySource = | 1451 Source librarySource = |
| 1451 sdkSourceFactory.resolveUri(unitSource, libraryUri); | 1452 sdkSourceFactory.resolveUri(unitSource, libraryUri); |
| 1452 // prepare LibraryElement | 1453 // prepare LibraryElement |
| 1453 LibraryElement libraryElement = | 1454 LibraryElement libraryElement = |
| 1454 context.getLibraryElement(librarySource); | 1455 context.getResult(librarySource, LIBRARY_ELEMENT8); |
| 1455 if (libraryElement == null) { | 1456 if (libraryElement == null) { |
| 1456 continue; | 1457 continue; |
| 1457 } | 1458 } |
| 1458 // prepare exported Element | 1459 // prepare exported Element |
| 1459 Element element = getExportedElement(libraryElement, name); | 1460 Element element = getExportedElement(libraryElement, name); |
| 1460 if (element == null) { | 1461 if (element == null) { |
| 1461 continue; | 1462 continue; |
| 1462 } | 1463 } |
| 1463 if (element is PropertyAccessorElement) { | 1464 if (element is PropertyAccessorElement) { |
| 1464 element = (element as PropertyAccessorElement).variable; | 1465 element = (element as PropertyAccessorElement).variable; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1477 // we don't need SDK libraries here | 1478 // we don't need SDK libraries here |
| 1478 if (librarySource.isInSystemLibrary) { | 1479 if (librarySource.isInSystemLibrary) { |
| 1479 continue; | 1480 continue; |
| 1480 } | 1481 } |
| 1481 // maybe already imported with a prefix | 1482 // maybe already imported with a prefix |
| 1482 if (alreadyImportedWithPrefix.contains(librarySource)) { | 1483 if (alreadyImportedWithPrefix.contains(librarySource)) { |
| 1483 continue; | 1484 continue; |
| 1484 } | 1485 } |
| 1485 // prepare LibraryElement | 1486 // prepare LibraryElement |
| 1486 LibraryElement libraryElement = | 1487 LibraryElement libraryElement = |
| 1487 context.getLibraryElement(librarySource); | 1488 context.getResult(librarySource, LIBRARY_ELEMENT8); |
| 1488 if (libraryElement == null) { | 1489 if (libraryElement == null) { |
| 1489 continue; | 1490 continue; |
| 1490 } | 1491 } |
| 1491 // prepare exported Element | 1492 // prepare exported Element |
| 1492 Element element = getExportedElement(libraryElement, name); | 1493 Element element = getExportedElement(libraryElement, name); |
| 1493 if (element == null) { | 1494 if (element == null) { |
| 1494 continue; | 1495 continue; |
| 1495 } | 1496 } |
| 1496 if (element is PropertyAccessorElement) { | 1497 if (element is PropertyAccessorElement) { |
| 1497 element = (element as PropertyAccessorElement).variable; | 1498 element = (element as PropertyAccessorElement).variable; |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2833 /** | 2834 /** |
| 2834 * Describes the location for a newly created [FieldDeclaration]. | 2835 * Describes the location for a newly created [FieldDeclaration]. |
| 2835 */ | 2836 */ |
| 2836 class _FieldLocation { | 2837 class _FieldLocation { |
| 2837 final String prefix; | 2838 final String prefix; |
| 2838 final int offset; | 2839 final int offset; |
| 2839 final String suffix; | 2840 final String suffix; |
| 2840 | 2841 |
| 2841 _FieldLocation(this.prefix, this.offset, this.suffix); | 2842 _FieldLocation(this.prefix, this.offset, this.suffix); |
| 2842 } | 2843 } |
| OLD | NEW |