| 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 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
| 7 | 7 |
| 8 import 'package:crypto/crypto.dart'; | 8 import 'package:crypto/crypto.dart'; |
| 9 import 'package:front_end/file_system.dart'; | 9 import 'package:front_end/file_system.dart'; |
| 10 import 'package:front_end/src/base/resolve_relative_uri.dart'; | 10 import 'package:front_end/src/base/resolve_relative_uri.dart'; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if (file == null) { | 255 if (file == null) { |
| 256 file = new FileState._(this, absoluteUri, fileUri); | 256 file = new FileState._(this, absoluteUri, fileUri); |
| 257 _uriToFile[absoluteUri] = file; | 257 _uriToFile[absoluteUri] = file; |
| 258 _fileUriToFile[fileUri] = file; | 258 _fileUriToFile[fileUri] = file; |
| 259 | 259 |
| 260 // Build the sub-graph of the file. | 260 // Build the sub-graph of the file. |
| 261 await file.refresh(); | 261 await file.refresh(); |
| 262 } | 262 } |
| 263 return file; | 263 return file; |
| 264 } | 264 } |
| 265 |
| 266 /// Return the [FileState] for the given [fileUri], or `null` if the |
| 267 /// [fileUri] does not yet correspond to any referenced [FileState]. |
| 268 FileState getFileByFileUri(Uri fileUri) => _fileUriToFile[fileUri]; |
| 265 } | 269 } |
| 266 | 270 |
| 267 /// List of libraries that reference each other, so form a cycle. | 271 /// List of libraries that reference each other, so form a cycle. |
| 268 class LibraryCycle { | 272 class LibraryCycle { |
| 269 final List<FileState> libraries = <FileState>[]; | 273 final List<FileState> libraries = <FileState>[]; |
| 270 | 274 |
| 271 bool get _isForVm { | 275 bool get _isForVm { |
| 272 return libraries.any((l) => l.uri.toString().endsWith('dart:_vmservice')); | 276 return libraries.any((l) => l.uri.toString().endsWith('dart:_vmservice')); |
| 273 } | 277 } |
| 274 | 278 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 node.isEvaluated = true; | 398 node.isEvaluated = true; |
| 395 cycle.libraries.add(node.file); | 399 cycle.libraries.add(node.file); |
| 396 } | 400 } |
| 397 topologicallySortedCycles.add(cycle); | 401 topologicallySortedCycles.add(cycle); |
| 398 } | 402 } |
| 399 | 403 |
| 400 _LibraryNode getNode(FileState file) { | 404 _LibraryNode getNode(FileState file) { |
| 401 return nodesOfFiles.putIfAbsent(file, () => new _LibraryNode(this, file)); | 405 return nodesOfFiles.putIfAbsent(file, () => new _LibraryNode(this, file)); |
| 402 } | 406 } |
| 403 } | 407 } |
| OLD | NEW |