| 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 | 2 |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import 'dart:collection' show HashMap, HashSet; | 6 import 'dart:collection' show HashMap, HashSet; |
| 7 import 'dart:math' show min, max; | 7 import 'dart:math' show min, max; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 @override | 585 @override |
| 586 visitCompilationUnit(CompilationUnit unit) { | 586 visitCompilationUnit(CompilationUnit unit) { |
| 587 // NOTE: this method isn't the right place to initialize | 587 // NOTE: this method isn't the right place to initialize |
| 588 // per-compilation-unit state. Declarations can be visited out of order, | 588 // per-compilation-unit state. Declarations can be visited out of order, |
| 589 // this is only to catch things that haven't been emitted yet. | 589 // this is only to catch things that haven't been emitted yet. |
| 590 // | 590 // |
| 591 // See _emitTypeDeclaration. | 591 // See _emitTypeDeclaration. |
| 592 var library = unit.element.library; | 592 var library = unit.element.library; |
| 593 bool internalSdk = isSdkInternalRuntime(library); | 593 bool internalSdk = isSdkInternalRuntime(library); |
| 594 _currentElements.add(library); | 594 _currentElements.add(library); |
| 595 | |
| 596 List<VariableDeclaration> fields; | 595 List<VariableDeclaration> fields; |
| 597 for (var declaration in unit.declarations) { | 596 for (var declaration in unit.declarations) { |
| 598 if (declaration is TopLevelVariableDeclaration) { | 597 if (declaration is TopLevelVariableDeclaration) { |
| 599 inferNullableTypes(declaration); | 598 inferNullableTypes(declaration); |
| 600 if (internalSdk && declaration.variables.isFinal) { | 599 if (internalSdk && declaration.variables.isFinal) { |
| 601 _emitInternalSdkFields(declaration.variables.variables); | 600 _emitInternalSdkFields(declaration.variables.variables); |
| 602 } else { | 601 } else { |
| 603 (fields ??= []).addAll(declaration.variables.variables); | 602 (fields ??= []).addAll(declaration.variables.variables); |
| 604 } | 603 } |
| 605 continue; | 604 continue; |
| (...skipping 5223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5829 if (targetIdentifier.staticElement is! PrefixElement) return false; | 5828 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 5830 var prefix = targetIdentifier.staticElement as PrefixElement; | 5829 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 5831 | 5830 |
| 5832 // The library the prefix is referring to must come from a deferred import. | 5831 // The library the prefix is referring to must come from a deferred import. |
| 5833 var containingLibrary = resolutionMap | 5832 var containingLibrary = resolutionMap |
| 5834 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 5833 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 5835 .library; | 5834 .library; |
| 5836 var imports = containingLibrary.getImportsWithPrefix(prefix); | 5835 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 5837 return imports.length == 1 && imports[0].isDeferred; | 5836 return imports.length == 1 && imports[0].isDeferred; |
| 5838 } | 5837 } |
| OLD | NEW |