| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 // Declare imports | 316 // Declare imports |
| 317 _finishImports(items); | 317 _finishImports(items); |
| 318 | 318 |
| 319 // Discharge the type table cache variables and | 319 // Discharge the type table cache variables and |
| 320 // hoisted definitions. | 320 // hoisted definitions. |
| 321 items.addAll(_typeTable.discharge()); | 321 items.addAll(_typeTable.discharge()); |
| 322 | 322 |
| 323 // Track the module name for each library in the module. | 323 // Track the module name for each library in the module. |
| 324 // This data is only required for debugging. | 324 // This data is only required for debugging. |
| 325 _moduleItems.add(js.statement('#.trackLibraries(#, #);', | 325 _moduleItems.add(js.statement( |
| 326 '#.trackLibraries(#, #, ${JSModuleFile.sourceMapHoleID});', |
| 326 [_runtimeModule, js.string(name), _librariesDebuggerObject()])); | 327 [_runtimeModule, js.string(name), _librariesDebuggerObject()])); |
| 327 | 328 |
| 328 // Add the module's code (produced by visiting compilation units, above) | 329 // Add the module's code (produced by visiting compilation units, above) |
| 329 _copyAndFlattenBlocks(items, _moduleItems); | 330 _copyAndFlattenBlocks(items, _moduleItems); |
| 330 | 331 |
| 331 // Build the module. | 332 // Build the module. |
| 332 return new JS.Program(items, name: _buildUnit.name); | 333 return new JS.Program(items, name: _buildUnit.name); |
| 333 } | 334 } |
| 334 | 335 |
| 335 JS.ObjectInitializer _librariesDebuggerObject() { | 336 JS.ObjectInitializer _librariesDebuggerObject() { |
| (...skipping 5620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5956 if (targetIdentifier.staticElement is! PrefixElement) return false; | 5957 if (targetIdentifier.staticElement is! PrefixElement) return false; |
| 5957 var prefix = targetIdentifier.staticElement as PrefixElement; | 5958 var prefix = targetIdentifier.staticElement as PrefixElement; |
| 5958 | 5959 |
| 5959 // The library the prefix is referring to must come from a deferred import. | 5960 // The library the prefix is referring to must come from a deferred import. |
| 5960 var containingLibrary = resolutionMap | 5961 var containingLibrary = resolutionMap |
| 5961 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 5962 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
| 5962 .library; | 5963 .library; |
| 5963 var imports = containingLibrary.getImportsWithPrefix(prefix); | 5964 var imports = containingLibrary.getImportsWithPrefix(prefix); |
| 5964 return imports.length == 1 && imports[0].isDeferred; | 5965 return imports.length == 1 && imports[0].isDeferred; |
| 5965 } | 5966 } |
| OLD | NEW |