| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 /// Because D depends on B, we'll emit B first if needed. However C is not | 505 /// Because D depends on B, we'll emit B first if needed. However C is not |
| 506 /// used by top-level JavaScript code, so we can ignore that dependency. | 506 /// used by top-level JavaScript code, so we can ignore that dependency. |
| 507 void _emitDeclaration(Element e) { | 507 void _emitDeclaration(Element e) { |
| 508 var item = _loader.emitDeclaration(e, (AstNode node) { | 508 var item = _loader.emitDeclaration(e, (AstNode node) { |
| 509 // TODO(jmesserly): this is not really the right place for this. | 509 // TODO(jmesserly): this is not really the right place for this. |
| 510 // Ideally we do this per function body. | 510 // Ideally we do this per function body. |
| 511 // | 511 // |
| 512 // We'll need to be consistent about when we're generating functions, and | 512 // We'll need to be consistent about when we're generating functions, and |
| 513 // only run this on the outermost function, and not any closures. | 513 // only run this on the outermost function, and not any closures. |
| 514 inferNullableTypes(node); | 514 inferNullableTypes(node); |
| 515 return _visit(node); | 515 return _visit(node) as JS.Node; |
| 516 }); | 516 }); |
| 517 | 517 |
| 518 if (item != null) _moduleItems.add(item); | 518 if (item != null) _moduleItems.add(item); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void _declareBeforeUse(Element e) { | 521 void _declareBeforeUse(Element e) { |
| 522 _loader.declareBeforeUse(e, _emitDeclaration); | 522 _loader.declareBeforeUse(e, _emitDeclaration); |
| 523 } | 523 } |
| 524 | 524 |
| 525 void _finishDeclarationsInUnit(CompilationUnit unit) { | 525 void _finishDeclarationsInUnit(CompilationUnit unit) { |
| (...skipping 5513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6039 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6039 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 6040 var prefix = targetIdentifier.staticElement as PrefixElement; | 6040 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 6041 | 6041 |
| 6042 // The library the prefix is referring to must come from a deferred import. | 6042 // The library the prefix is referring to must come from a deferred import. |
| 6043 var containingLibrary = resolutionMap | 6043 var containingLibrary = resolutionMap |
| 6044 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6044 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 6045 .library; | 6045 .library; |
| 6046 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6046 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 6047 return imports.length == 1 && imports[0].isDeferred; | 6047 return imports.length == 1 && imports[0].isDeferred; |
| 6048 } | 6048 } |
| OLD | NEW |