Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: lib/src/codegen/js_module_item_order.dart

Issue 1141133002: isLoaded can now handle elements from other libraries (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:collection' show HashMap; 5 import 'dart:collection' show HashMap;
6 import 'package:analyzer/src/generated/ast.dart'; 6 import 'package:analyzer/src/generated/ast.dart';
7 import 'package:analyzer/src/generated/element.dart'; 7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:dev_compiler/src/dependency_graph.dart' show corelibOrder; 8 import 'package:dev_compiler/src/dependency_graph.dart' show corelibOrder;
9 9
10 typedef void ModuleItemEmitter(AstNode item); 10 typedef void ModuleItemEmitter(AstNode item);
(...skipping 28 matching lines...) Expand all
39 39
40 /// Memoized results of [_inLibraryCycle]. 40 /// Memoized results of [_inLibraryCycle].
41 final _libraryCycleMemo = new HashMap<LibraryElement, bool>(); 41 final _libraryCycleMemo = new HashMap<LibraryElement, bool>();
42 42
43 final ModuleItemEmitter _emitModuleItem; 43 final ModuleItemEmitter _emitModuleItem;
44 44
45 LibraryElement _currentLibrary; 45 LibraryElement _currentLibrary;
46 46
47 ModuleItemLoadOrder(this._emitModuleItem); 47 ModuleItemLoadOrder(this._emitModuleItem);
48 48
49 bool isLoaded(Element e) => _loaded[e] == true; 49 bool isLoaded(Element e) => (e.library == _currentLibrary)
50 ? _loaded[e] == true
51 : libraryIsLoaded(e.library);
50 52
51 /// Collect top-level elements and nodes we need to emit. 53 /// Collect top-level elements and nodes we need to emit.
52 void collectElements( 54 void collectElements(
53 LibraryElement library, Iterable<CompilationUnit> partsThenLibrary) { 55 LibraryElement library, Iterable<CompilationUnit> partsThenLibrary) {
54 assert(_currentLibrary == null); 56 assert(_currentLibrary == null);
55 _currentLibrary = library; 57 _currentLibrary = library;
56 58
57 for (var unit in partsThenLibrary) { 59 for (var unit in partsThenLibrary) {
58 for (var decl in unit.declarations) { 60 for (var decl in unit.declarations) {
59 _declarationNodes[decl.element] = decl; 61 _declarationNodes[decl.element] = decl;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (result) break; 220 if (result) break;
219 result = _inLibraryCycle(e.importedLibrary); 221 result = _inLibraryCycle(e.importedLibrary);
220 } 222 }
221 for (var e in library.exports) { 223 for (var e in library.exports) {
222 if (result) break; 224 if (result) break;
223 result = _inLibraryCycle(e.exportedLibrary); 225 result = _inLibraryCycle(e.exportedLibrary);
224 } 226 }
225 return _libraryCycleMemo[library] = result; 227 return _libraryCycleMemo[library] = result;
226 } 228 }
227 } 229 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698