| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library services.src.correction.fix; | 8 library services.src.correction.fix; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 */ | 43 */ |
| 44 class FixProcessor { | 44 class FixProcessor { |
| 45 static const int MAX_LEVENSHTEIN_DISTANCE = 3; | 45 static const int MAX_LEVENSHTEIN_DISTANCE = 3; |
| 46 | 46 |
| 47 final SearchEngine searchEngine; | 47 final SearchEngine searchEngine; |
| 48 final Source source; | 48 final Source source; |
| 49 final String file; | 49 final String file; |
| 50 final CompilationUnit unit; | 50 final CompilationUnit unit; |
| 51 final AnalysisError error; | 51 final AnalysisError error; |
| 52 CompilationUnitElement unitElement; | 52 CompilationUnitElement unitElement; |
| 53 Source unitSource; |
| 53 LibraryElement unitLibraryElement; | 54 LibraryElement unitLibraryElement; |
| 54 String unitLibraryFile; | 55 String unitLibraryFile; |
| 55 String unitLibraryFolder; | 56 String unitLibraryFolder; |
| 56 | 57 |
| 57 final List<Edit> edits = <Edit>[]; | 58 final List<Edit> edits = <Edit>[]; |
| 58 final Map<String, LinkedEditGroup> linkedPositionGroups = <String, | 59 final Map<String, LinkedEditGroup> linkedPositionGroups = <String, |
| 59 LinkedEditGroup>{}; | 60 LinkedEditGroup>{}; |
| 60 Position exitPosition = null; | 61 Position exitPosition = null; |
| 61 final List<Fix> fixes = <Fix>[]; | 62 final List<Fix> fixes = <Fix>[]; |
| 62 | 63 |
| 63 CorrectionUtils utils; | 64 CorrectionUtils utils; |
| 64 int errorOffset; | 65 int errorOffset; |
| 65 int errorLength; | 66 int errorLength; |
| 66 int errorEnd; | 67 int errorEnd; |
| 67 AstNode node; | 68 AstNode node; |
| 68 AstNode coveredNode; | 69 AstNode coveredNode; |
| 69 | 70 |
| 70 FixProcessor(this.searchEngine, this.source, this.file, this.unit, this.error) | 71 FixProcessor(this.searchEngine, this.source, this.file, this.unit, this.error) |
| 71 { | 72 { |
| 72 unitElement = unit.element; | 73 unitElement = unit.element; |
| 74 unitSource = unitElement.source; |
| 73 unitLibraryElement = unitElement.library; | 75 unitLibraryElement = unitElement.library; |
| 74 unitLibraryFile = unitLibraryElement.source.fullName; | 76 unitLibraryFile = unitLibraryElement.source.fullName; |
| 75 unitLibraryFolder = dirname(unitLibraryFile); | 77 unitLibraryFolder = dirname(unitLibraryFile); |
| 76 } | 78 } |
| 77 | 79 |
| 78 DartType get coreTypeBool => _getCoreType("bool"); | 80 DartType get coreTypeBool => _getCoreType("bool"); |
| 79 | 81 |
| 80 /** | 82 /** |
| 81 * Returns the EOL to use for this [CompilationUnit]. | 83 * Returns the EOL to use for this [CompilationUnit]. |
| 82 */ | 84 */ |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 return; | 771 return; |
| 770 } | 772 } |
| 771 } | 773 } |
| 772 // check SDK libraries | 774 // check SDK libraries |
| 773 AnalysisContext context = unitLibraryElement.context; | 775 AnalysisContext context = unitLibraryElement.context; |
| 774 { | 776 { |
| 775 DartSdk sdk = context.sourceFactory.dartSdk; | 777 DartSdk sdk = context.sourceFactory.dartSdk; |
| 776 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; | 778 List<SdkLibrary> sdkLibraries = sdk.sdkLibraries; |
| 777 for (SdkLibrary sdkLibrary in sdkLibraries) { | 779 for (SdkLibrary sdkLibrary in sdkLibraries) { |
| 778 SourceFactory sdkSourceFactory = context.sourceFactory; | 780 SourceFactory sdkSourceFactory = context.sourceFactory; |
| 779 String libraryUri = sdkLibrary.shortName; | 781 String libraryUri = 'dart:' + sdkLibrary.shortName; |
| 780 Source librarySource = sdkSourceFactory.resolveUri(null, libraryUri); | 782 Source librarySource = |
| 783 sdkSourceFactory.resolveUri(unitSource, libraryUri); |
| 781 // prepare LibraryElement | 784 // prepare LibraryElement |
| 782 LibraryElement libraryElement = | 785 LibraryElement libraryElement = |
| 783 context.getLibraryElement(librarySource); | 786 context.getLibraryElement(librarySource); |
| 784 if (libraryElement == null) { | 787 if (libraryElement == null) { |
| 785 continue; | 788 continue; |
| 786 } | 789 } |
| 787 // prepare exported Element | 790 // prepare exported Element |
| 788 Element element = getExportedElement(libraryElement, name); | 791 Element element = getExportedElement(libraryElement, name); |
| 789 if (element == null) { | 792 if (element == null) { |
| 790 continue; | 793 continue; |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 /** | 1906 /** |
| 1904 * Describes the location for a newly created [ConstructorDeclaration]. | 1907 * Describes the location for a newly created [ConstructorDeclaration]. |
| 1905 */ | 1908 */ |
| 1906 class _ConstructorLocation { | 1909 class _ConstructorLocation { |
| 1907 final String _prefix; | 1910 final String _prefix; |
| 1908 final int _offset; | 1911 final int _offset; |
| 1909 final String _suffix; | 1912 final String _suffix; |
| 1910 | 1913 |
| 1911 _ConstructorLocation(this._prefix, this._offset, this._suffix); | 1914 _ConstructorLocation(this._prefix, this._offset, this._suffix); |
| 1912 } | 1915 } |
| OLD | NEW |