| 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 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 { | 1440 { |
| 1440 DartSdk sdk = context.sourceFactory.dartSdk; | 1441 DartSdk sdk = context.sourceFactory.dartSdk; |
| 1441 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; | 1442 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; |
| 1442 for (SdkLibrary sdkLibrary in sdkLibraries) { | 1443 for (SdkLibrary sdkLibrary in sdkLibraries) { |
| 1443 SourceFactory sdkSourceFactory = context.sourceFactory; | 1444 SourceFactory sdkSourceFactory = context.sourceFactory; |
| 1444 String libraryUri = sdkLibrary.shortName; | 1445 String libraryUri = sdkLibrary.shortName; |
| 1445 Source librarySource = | 1446 Source librarySource = |
| 1446 sdkSourceFactory.resolveUri(unitSource, libraryUri); | 1447 sdkSourceFactory.resolveUri(unitSource, libraryUri); |
| 1447 // prepare LibraryElement | 1448 // prepare LibraryElement |
| 1448 LibraryElement libraryElement = | 1449 LibraryElement libraryElement = |
| 1449 context.getLibraryElement(librarySource); | 1450 context.getResult(librarySource, LIBRARY_ELEMENT8); |
| 1450 if (libraryElement == null) { | 1451 if (libraryElement == null) { |
| 1451 continue; | 1452 continue; |
| 1452 } | 1453 } |
| 1453 // prepare exported Element | 1454 // prepare exported Element |
| 1454 Element element = getExportedElement(libraryElement, name); | 1455 Element element = getExportedElement(libraryElement, name); |
| 1455 if (element == null) { | 1456 if (element == null) { |
| 1456 continue; | 1457 continue; |
| 1457 } | 1458 } |
| 1458 if (element is PropertyAccessorElement) { | 1459 if (element is PropertyAccessorElement) { |
| 1459 element = (element as PropertyAccessorElement).variable; | 1460 element = (element as PropertyAccessorElement).variable; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1472 // we don't need SDK libraries here | 1473 // we don't need SDK libraries here |
| 1473 if (librarySource.isInSystemLibrary) { | 1474 if (librarySource.isInSystemLibrary) { |
| 1474 continue; | 1475 continue; |
| 1475 } | 1476 } |
| 1476 // maybe already imported with a prefix | 1477 // maybe already imported with a prefix |
| 1477 if (alreadyImportedWithPrefix.contains(librarySource)) { | 1478 if (alreadyImportedWithPrefix.contains(librarySource)) { |
| 1478 continue; | 1479 continue; |
| 1479 } | 1480 } |
| 1480 // prepare LibraryElement | 1481 // prepare LibraryElement |
| 1481 LibraryElement libraryElement = | 1482 LibraryElement libraryElement = |
| 1482 context.getLibraryElement(librarySource); | 1483 context.getResult(librarySource, LIBRARY_ELEMENT8); |
| 1483 if (libraryElement == null) { | 1484 if (libraryElement == null) { |
| 1484 continue; | 1485 continue; |
| 1485 } | 1486 } |
| 1486 // prepare exported Element | 1487 // prepare exported Element |
| 1487 Element element = getExportedElement(libraryElement, name); | 1488 Element element = getExportedElement(libraryElement, name); |
| 1488 if (element == null) { | 1489 if (element == null) { |
| 1489 continue; | 1490 continue; |
| 1490 } | 1491 } |
| 1491 if (element is PropertyAccessorElement) { | 1492 if (element is PropertyAccessorElement) { |
| 1492 element = (element as PropertyAccessorElement).variable; | 1493 element = (element as PropertyAccessorElement).variable; |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2827 /** | 2828 /** |
| 2828 * Describes the location for a newly created [FieldDeclaration]. | 2829 * Describes the location for a newly created [FieldDeclaration]. |
| 2829 */ | 2830 */ |
| 2830 class _FieldLocation { | 2831 class _FieldLocation { |
| 2831 final String prefix; | 2832 final String prefix; |
| 2832 final int offset; | 2833 final int offset; |
| 2833 final String suffix; | 2834 final String suffix; |
| 2834 | 2835 |
| 2835 _FieldLocation(this.prefix, this.offset, this.suffix); | 2836 _FieldLocation(this.prefix, this.offset, this.suffix); |
| 2836 } | 2837 } |
| OLD | NEW |