OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:convert'; | 5 import 'dart:convert'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 | 7 |
8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
9 import 'package:analyzer/dart/ast/token.dart'; | 9 import 'package:analyzer/dart/ast/token.dart'; |
10 import 'package:analyzer/error/listener.dart'; | 10 import 'package:analyzer/error/listener.dart'; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 /** | 112 /** |
113 * Return the list of all direct dependencies. | 113 * Return the list of all direct dependencies. |
114 */ | 114 */ |
115 List<FileState> get dependencies => _dependencies; | 115 List<FileState> get dependencies => _dependencies; |
116 | 116 |
117 /** | 117 /** |
118 * The list of files this file exports. | 118 * The list of files this file exports. |
119 */ | 119 */ |
120 List<FileState> get exportedFiles => _exportedFiles; | 120 List<FileState> get exportedFiles => _exportedFiles; |
121 | 121 |
| 122 @override |
| 123 int get hashCode => uri.hashCode; |
| 124 |
122 /** | 125 /** |
123 * The list of files this file imports. | 126 * The list of files this file imports. |
124 */ | 127 */ |
125 List<FileState> get importedFiles => _importedFiles; | 128 List<FileState> get importedFiles => _importedFiles; |
126 | 129 |
127 /** | 130 /** |
128 * Return information about line in the file. | 131 * Return information about line in the file. |
129 */ | 132 */ |
130 LineInfo get lineInfo => _lineInfo; | 133 LineInfo get lineInfo => _lineInfo; |
131 | 134 |
132 /** | 135 /** |
133 * The list of files this library file references as parts. | 136 * The list of files this library file references as parts. |
134 */ | 137 */ |
135 List<FileState> get partedFiles => _partedFiles; | 138 List<FileState> get partedFiles => _partedFiles; |
136 | 139 |
137 /** | 140 /** |
138 * The [UnlinkedUnit] of the file. | 141 * The [UnlinkedUnit] of the file. |
139 */ | 142 */ |
140 UnlinkedUnit get unlinked => _unlinked; | 143 UnlinkedUnit get unlinked => _unlinked; |
141 | 144 |
| 145 @override |
| 146 bool operator ==(Object other) { |
| 147 return other is FileState && other.uri == uri; |
| 148 } |
| 149 |
142 /** | 150 /** |
143 * Return a new parsed unresolved [CompilationUnit]. | 151 * Return a new parsed unresolved [CompilationUnit]. |
144 */ | 152 */ |
145 CompilationUnit parse(AnalysisErrorListener errorListener) { | 153 CompilationUnit parse(AnalysisErrorListener errorListener) { |
146 AnalysisOptions analysisOptions = _fsState._analysisOptions; | 154 AnalysisOptions analysisOptions = _fsState._analysisOptions; |
147 | 155 |
148 CharSequenceReader reader = new CharSequenceReader(content); | 156 CharSequenceReader reader = new CharSequenceReader(content); |
149 Scanner scanner = new Scanner(source, reader, errorListener); | 157 Scanner scanner = new Scanner(source, reader, errorListener); |
150 scanner.scanGenericMethodComments = analysisOptions.strongMode; | 158 scanner.scanGenericMethodComments = analysisOptions.strongMode; |
151 Token token = scanner.tokenize(); | 159 Token token = scanner.tokenize(); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 FileState canonicalFile = getFileForPath(path); | 406 FileState canonicalFile = getFileForPath(path); |
399 List<FileState> allFiles = _pathToFiles[path].toList(); | 407 List<FileState> allFiles = _pathToFiles[path].toList(); |
400 if (allFiles.length == 1) { | 408 if (allFiles.length == 1) { |
401 return allFiles; | 409 return allFiles; |
402 } | 410 } |
403 return allFiles | 411 return allFiles |
404 ..remove(canonicalFile) | 412 ..remove(canonicalFile) |
405 ..insert(0, canonicalFile); | 413 ..insert(0, canonicalFile); |
406 } | 414 } |
407 } | 415 } |
OLD | NEW |