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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2697093002: Deferred parsing for legacy modules (Closed)
Patch Set: Removing pending Created 3 years, 10 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
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 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 result.add(item); 414 result.add(item);
415 } 415 }
416 } 416 }
417 } 417 }
418 418
419 String _libraryToModule(LibraryElement library) { 419 String _libraryToModule(LibraryElement library) {
420 assert(!_libraries.containsKey(library)); 420 assert(!_libraries.containsKey(library));
421 var source = library.source; 421 var source = library.source;
422 // TODO(jmesserly): we need to split out HTML. 422 // TODO(jmesserly): we need to split out HTML.
423 if (source.uri.scheme == 'dart') { 423 if (source.uri.scheme == 'dart') {
424 return 'dart_sdk'; 424 return JS.dartSdkModule;
425 } 425 }
426 var moduleName = _buildUnit.libraryToModule(source); 426 var moduleName = _buildUnit.libraryToModule(source);
427 if (moduleName == null) { 427 if (moduleName == null) {
428 throw new StateError('Could not find module containing "$library".'); 428 throw new StateError('Could not find module containing "$library".');
429 } 429 }
430 return moduleName; 430 return moduleName;
431 } 431 }
432 432
433 void _finishImports(List<JS.ModuleItem> items) { 433 void _finishImports(List<JS.ModuleItem> items) {
434 var modules = new Map<String, List<LibraryElement>>(); 434 var modules = new Map<String, List<LibraryElement>>();
(...skipping 5455 matching lines...) Expand 10 before | Expand all | Expand 10 after
5890 if (targetIdentifier.staticElement is! PrefixElement) return false; 5890 if (targetIdentifier.staticElement is! PrefixElement) return false;
5891 var prefix = targetIdentifier.staticElement as PrefixElement; 5891 var prefix = targetIdentifier.staticElement as PrefixElement;
5892 5892
5893 // The library the prefix is referring to must come from a deferred import. 5893 // The library the prefix is referring to must come from a deferred import.
5894 var containingLibrary = resolutionMap 5894 var containingLibrary = resolutionMap
5895 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) 5895 .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
5896 .library; 5896 .library;
5897 var imports = containingLibrary.getImportsWithPrefix(prefix); 5897 var imports = containingLibrary.getImportsWithPrefix(prefix);
5898 return imports.length == 1 && imports[0].isDeferred; 5898 return imports.length == 1 && imports[0].isDeferred;
5899 } 5899 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698