Chromium Code Reviews| 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 analyzer.src.dart.element.builder; | 5 library analyzer.src.dart.element.builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 // | 153 // |
| 154 // Populate the library element. | 154 // Populate the library element. |
| 155 // | 155 // |
| 156 libraryElement.imports = imports; | 156 libraryElement.imports = imports; |
| 157 libraryElement.exports = exports; | 157 libraryElement.exports = exports; |
| 158 return null; | 158 return null; |
| 159 } | 159 } |
| 160 | 160 |
| 161 @override | 161 @override |
| 162 Object visitExportDirective(ExportDirective node) { | 162 Object visitExportDirective(ExportDirective node) { |
| 163 // Remove previous element. (It will remain null if the target is missing.) | |
| 164 node.element = null; | |
|
Brian Wilkerson
2016/02/27 18:05:21
I don't understand why this would be necessary. Di
| |
| 163 Source exportedSource = node.source; | 165 Source exportedSource = node.source; |
| 164 if (exportedSource != null && context.exists(exportedSource)) { | 166 if (exportedSource != null && context.exists(exportedSource)) { |
| 165 // The exported source will be null if the URI in the export | 167 // The exported source will be null if the URI in the export |
| 166 // directive was invalid. | 168 // directive was invalid. |
| 167 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; | 169 LibraryElement exportedLibrary = exportLibraryMap[exportedSource]; |
| 168 if (exportedLibrary != null) { | 170 if (exportedLibrary != null) { |
| 169 ExportElementImpl exportElement = new ExportElementImpl(node.offset); | 171 ExportElementImpl exportElement = new ExportElementImpl(node.offset); |
| 170 exportElement.metadata = _getElementAnnotations(node.metadata); | 172 exportElement.metadata = _getElementAnnotations(node.metadata); |
| 171 StringLiteral uriLiteral = node.uri; | 173 StringLiteral uriLiteral = node.uri; |
| 172 if (uriLiteral != null) { | 174 if (uriLiteral != null) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 193 CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, | 195 CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, |
| 194 [uriLiteral.toSource()])); | 196 [uriLiteral.toSource()])); |
| 195 } | 197 } |
| 196 } | 198 } |
| 197 } | 199 } |
| 198 return null; | 200 return null; |
| 199 } | 201 } |
| 200 | 202 |
| 201 @override | 203 @override |
| 202 Object visitImportDirective(ImportDirective node) { | 204 Object visitImportDirective(ImportDirective node) { |
| 205 // Remove previous element. (It will remain null if the target is missing.) | |
| 206 node.element = null; | |
| 207 | |
| 203 String uriContent = node.uriContent; | 208 String uriContent = node.uriContent; |
| 204 if (DartUriResolver.isDartExtUri(uriContent)) { | 209 if (DartUriResolver.isDartExtUri(uriContent)) { |
| 205 libraryElement.hasExtUri = true; | 210 libraryElement.hasExtUri = true; |
| 206 } | 211 } |
| 207 Source importedSource = node.source; | 212 Source importedSource = node.source; |
| 208 if (importedSource != null && context.exists(importedSource)) { | 213 if (importedSource != null && context.exists(importedSource)) { |
| 209 // The imported source will be null if the URI in the import | 214 // The imported source will be null if the URI in the import |
| 210 // directive was invalid. | 215 // directive was invalid. |
| 211 LibraryElement importedLibrary = importLibraryMap[importedSource]; | 216 LibraryElement importedLibrary = importLibraryMap[importedSource]; |
| 212 if (importedLibrary != null) { | 217 if (importedLibrary != null) { |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 return null; | 1418 return null; |
| 1414 } | 1419 } |
| 1415 | 1420 |
| 1416 /** | 1421 /** |
| 1417 * Return the lexical identifiers associated with the given [identifiers]. | 1422 * Return the lexical identifiers associated with the given [identifiers]. |
| 1418 */ | 1423 */ |
| 1419 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { | 1424 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { |
| 1420 return identifiers.map((identifier) => identifier.name).toList(); | 1425 return identifiers.map((identifier) => identifier.name).toList(); |
| 1421 } | 1426 } |
| 1422 } | 1427 } |
| OLD | NEW |