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/dependency_walker.dart' as graph; | 10 import 'package:front_end/src/dependency_walker.dart' as graph; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 _exportedLibraries = <FileState>[]; | 128 _exportedLibraries = <FileState>[]; |
129 _partFiles = <FileState>[]; | 129 _partFiles = <FileState>[]; |
130 _exports = <NamespaceExport>[]; | 130 _exports = <NamespaceExport>[]; |
131 { | 131 { |
132 FileState coreFile = await _getFileForRelativeUri('dart:core'); | 132 FileState coreFile = await _getFileForRelativeUri('dart:core'); |
133 // TODO(scheglov) add error handling | 133 // TODO(scheglov) add error handling |
134 if (coreFile != null) { | 134 if (coreFile != null) { |
135 _importedLibraries.add(coreFile); | 135 _importedLibraries.add(coreFile); |
136 } | 136 } |
137 } | 137 } |
138 for (ImportDirective import_ in listener.imports) { | 138 for (NamespaceDirective import_ in listener.imports) { |
139 FileState file = await _getFileForRelativeUri(import_.uri); | 139 FileState file = await _getFileForRelativeUri(import_.uri); |
140 if (file != null) { | 140 if (file != null) { |
141 _importedLibraries.add(file); | 141 _importedLibraries.add(file); |
142 } | 142 } |
143 } | 143 } |
144 await _addVmTargetImportsForCore(); | 144 await _addVmTargetImportsForCore(); |
145 for (ExportDirective export_ in listener.exports) { | 145 for (NamespaceDirective export_ in listener.exports) { |
146 FileState file = await _getFileForRelativeUri(export_.uri); | 146 FileState file = await _getFileForRelativeUri(export_.uri); |
147 if (file != null) { | 147 if (file != null) { |
148 _exportedLibraries.add(file); | 148 _exportedLibraries.add(file); |
149 _exports.add(new NamespaceExport(file, export_.combinators)); | 149 _exports.add(new NamespaceExport(file, export_.combinators)); |
150 } | 150 } |
151 } | 151 } |
152 for (String uri in listener.parts) { | 152 for (String uri in listener.parts) { |
153 FileState file = await _getFileForRelativeUri(uri); | 153 FileState file = await _getFileForRelativeUri(uri); |
154 if (file != null) { | 154 if (file != null) { |
155 _partFiles.add(file); | 155 _partFiles.add(file); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 280 } |
281 | 281 |
282 /// Information about a single `export` directive. | 282 /// Information about a single `export` directive. |
283 class NamespaceExport { | 283 class NamespaceExport { |
284 final FileState library; | 284 final FileState library; |
285 final List<NamespaceCombinator> combinators; | 285 final List<NamespaceCombinator> combinators; |
286 | 286 |
287 NamespaceExport(this.library, this.combinators); | 287 NamespaceExport(this.library, this.combinators); |
288 | 288 |
289 /// Return `true` if the [name] satisfies the sequence of the [combinators]. | 289 /// Return `true` if the [name] satisfies the sequence of the [combinators]. |
290 bool filter(String name) { | 290 bool isExposed(String name) { |
291 for (NamespaceCombinator combinator in combinators) { | 291 for (NamespaceCombinator combinator in combinators) { |
292 if (combinator.isShow) { | 292 if (combinator.isShow) { |
293 if (!combinator.names.contains(name)) { | 293 if (!combinator.names.contains(name)) { |
294 return false; | 294 return false; |
295 } | 295 } |
296 } else { | 296 } else { |
297 if (combinator.names.contains(name)) { | 297 if (combinator.names.contains(name)) { |
298 return false; | 298 return false; |
299 } | 299 } |
300 } | 300 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 node.isEvaluated = true; | 392 node.isEvaluated = true; |
393 cycle.libraries.add(node.file); | 393 cycle.libraries.add(node.file); |
394 } | 394 } |
395 topologicallySortedCycles.add(cycle); | 395 topologicallySortedCycles.add(cycle); |
396 } | 396 } |
397 | 397 |
398 _LibraryNode getNode(FileState file) { | 398 _LibraryNode getNode(FileState file) { |
399 return nodesOfFiles.putIfAbsent(file, () => new _LibraryNode(this, file)); | 399 return nodesOfFiles.putIfAbsent(file, () => new _LibraryNode(this, file)); |
400 } | 400 } |
401 } | 401 } |
OLD | NEW |