OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.task.dart; | 5 library analyzer.src.task.dart; |
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 4135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4146 directive.uriContent = uriContent; | 4146 directive.uriContent = uriContent; |
4147 } | 4147 } |
4148 defaultSource = _resolveUri(isImport, uriLiteral, uriContent); | 4148 defaultSource = _resolveUri(isImport, uriLiteral, uriContent); |
4149 directive.uriSource = defaultSource; | 4149 directive.uriSource = defaultSource; |
4150 } | 4150 } |
4151 | 4151 |
4152 // Resolve all configurations and try to choose one. | 4152 // Resolve all configurations and try to choose one. |
4153 if (directive is NamespaceDirectiveImpl) { | 4153 if (directive is NamespaceDirectiveImpl) { |
4154 Source configurationSource; | 4154 Source configurationSource; |
4155 for (Configuration configuration in directive.configurations) { | 4155 for (Configuration configuration in directive.configurations) { |
4156 Source source = _resolveUri(isImport, configuration.libraryUri, | 4156 Source source = _resolveUri( |
4157 configuration.libraryUri.stringValue); | 4157 isImport, configuration.uri, configuration.uri.stringValue); |
4158 configuration.uriSource = source; | 4158 configuration.uriSource = source; |
4159 if (configurationSource == null) { | 4159 if (configurationSource == null) { |
4160 String variableName = | 4160 String variableName = |
4161 configuration.name.components.map((i) => i.name).join('.'); | 4161 configuration.name.components.map((i) => i.name).join('.'); |
4162 String variableValue = context.declaredVariables.get(variableName); | 4162 String variableValue = context.declaredVariables.get(variableName); |
4163 if (configuration.value != null && | 4163 if (configuration.value != null && |
4164 variableValue == configuration.value.stringValue || | 4164 variableValue == configuration.value.stringValue || |
4165 variableValue == 'true') { | 4165 variableValue == 'true') { |
4166 configurationSource = source; | 4166 configurationSource = source; |
4167 } | 4167 } |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6228 } | 6228 } |
6229 | 6229 |
6230 /** | 6230 /** |
6231 * Check the given [directive] to see if the referenced source exists and | 6231 * Check the given [directive] to see if the referenced source exists and |
6232 * report an error if it does not. | 6232 * report an error if it does not. |
6233 */ | 6233 */ |
6234 void validateReferencedSource(UriBasedDirective directive) { | 6234 void validateReferencedSource(UriBasedDirective directive) { |
6235 if (directive is NamespaceDirective) { | 6235 if (directive is NamespaceDirective) { |
6236 for (Configuration configuration in directive.configurations) { | 6236 for (Configuration configuration in directive.configurations) { |
6237 Source source = configuration.uriSource; | 6237 Source source = configuration.uriSource; |
6238 StringLiteral uriLiteral = configuration.libraryUri; | 6238 StringLiteral uriLiteral = configuration.uri; |
6239 String uriContent = uriLiteral?.stringValue?.trim(); | 6239 String uriContent = uriLiteral?.stringValue?.trim(); |
6240 if (source != null) { | 6240 if (source != null) { |
6241 int modificationTime = sourceTimeMap[source] ?? -1; | 6241 int modificationTime = sourceTimeMap[source] ?? -1; |
6242 if (modificationTime >= 0) { | 6242 if (modificationTime >= 0) { |
6243 continue; | 6243 continue; |
6244 } | 6244 } |
6245 } else { | 6245 } else { |
6246 // Don't report errors already reported by ParseDartTask.resolveDirect
ive | 6246 // Don't report errors already reported by ParseDartTask.resolveDirect
ive |
6247 if (UriBasedDirectiveImpl.validateUri( | 6247 if (UriBasedDirectiveImpl.validateUri( |
6248 directive is ImportDirective, uriLiteral, uriContent) != | 6248 directive is ImportDirective, uriLiteral, uriContent) != |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6441 | 6441 |
6442 @override | 6442 @override |
6443 bool moveNext() { | 6443 bool moveNext() { |
6444 if (_newSources.isEmpty) { | 6444 if (_newSources.isEmpty) { |
6445 return false; | 6445 return false; |
6446 } | 6446 } |
6447 currentTarget = _newSources.removeLast(); | 6447 currentTarget = _newSources.removeLast(); |
6448 return true; | 6448 return true; |
6449 } | 6449 } |
6450 } | 6450 } |
OLD | NEW |