| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 EventSink, | 8 EventSink, |
| 9 Future; | 9 Future; |
| 10 | 10 |
| 11 import '../compiler_new.dart' as api; | 11 import '../compiler_new.dart' as api; |
| 12 import 'cache_strategy.dart' show | 12 import 'cache_strategy.dart' show |
| 13 CacheStrategy; | 13 CacheStrategy; |
| 14 import 'closure.dart' as closureMapping show | 14 import 'closure.dart' as closureMapping show |
| 15 ClosureTask; | 15 ClosureTask; |
| 16 import 'common.dart'; | 16 import 'common.dart'; |
| 17 import 'common/backend_api.dart' show | 17 import 'common/backend_api.dart' show |
| 18 Backend; | 18 Backend; |
| 19 import 'common/codegen.dart' show | 19 import 'common/codegen.dart' show |
| 20 CodegenRegistry, | 20 CodegenImpact, |
| 21 CodegenWorkItem; | 21 CodegenWorkItem; |
| 22 import 'common/names.dart' show | 22 import 'common/names.dart' show |
| 23 Identifiers, | 23 Identifiers, |
| 24 Uris; | 24 Uris; |
| 25 import 'common/registry.dart' show | 25 import 'common/registry.dart' show |
| 26 EagerRegistry, |
| 26 Registry; | 27 Registry; |
| 27 import 'common/resolution.dart' show | 28 import 'common/resolution.dart' show |
| 28 Parsing, | 29 Parsing, |
| 29 Resolution, | 30 Resolution, |
| 30 ResolutionWorkItem, | 31 ResolutionWorkItem, |
| 31 ResolutionImpact; | 32 ResolutionImpact; |
| 32 import 'common/tasks.dart' show | 33 import 'common/tasks.dart' show |
| 33 CompilerTask, | 34 CompilerTask, |
| 34 GenericTask; | 35 GenericTask; |
| 35 import 'common/work.dart' show | 36 import 'common/work.dart' show |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 assert(invariant(element, !element.isSynthesized || tree == null)); | 1998 assert(invariant(element, !element.isSynthesized || tree == null)); |
| 1998 ResolutionImpact resolutionImpact = | 1999 ResolutionImpact resolutionImpact = |
| 1999 compiler.resolver.resolve(element); | 2000 compiler.resolver.resolve(element); |
| 2000 if (tree != null && !compiler.analyzeSignaturesOnly) { | 2001 if (tree != null && !compiler.analyzeSignaturesOnly) { |
| 2001 // TODO(het): don't do this if suppressWarnings is on, currently we have | 2002 // TODO(het): don't do this if suppressWarnings is on, currently we have |
| 2002 // to do it because the typechecker also sets types | 2003 // to do it because the typechecker also sets types |
| 2003 // Only analyze nodes with a corresponding [TreeElements]. | 2004 // Only analyze nodes with a corresponding [TreeElements]. |
| 2004 compiler.checker.check(element); | 2005 compiler.checker.check(element); |
| 2005 } | 2006 } |
| 2006 WorldImpact worldImpact = | 2007 WorldImpact worldImpact = |
| 2007 compiler.backend.resolutionCallbacks.transformImpact( | 2008 compiler.backend.impactTransformer.transformResolutionImpact( |
| 2008 resolutionImpact); | 2009 resolutionImpact); |
| 2009 return worldImpact; | 2010 return worldImpact; |
| 2010 }); | 2011 }); |
| 2011 } | 2012 } |
| 2012 | 2013 |
| 2013 @override | 2014 @override |
| 2014 bool hasBeenResolved(Element element) { | 2015 bool hasBeenResolved(Element element) { |
| 2015 return _worldImpactCache.containsKey(element); | 2016 return _worldImpactCache.containsKey(element); |
| 2016 } | 2017 } |
| 2017 } | 2018 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2037 } | 2038 } |
| 2038 }); | 2039 }); |
| 2039 } | 2040 } |
| 2040 | 2041 |
| 2041 ScannerOptions getScannerOptionsFor(Element element) { | 2042 ScannerOptions getScannerOptionsFor(Element element) { |
| 2042 return new ScannerOptions( | 2043 return new ScannerOptions( |
| 2043 canUseNative: compiler.backend.canLibraryUseNative(element.library)); | 2044 canUseNative: compiler.backend.canLibraryUseNative(element.library)); |
| 2044 } | 2045 } |
| 2045 } | 2046 } |
| 2046 | 2047 |
| 2047 class GlobalDependencyRegistry extends CodegenRegistry { | 2048 class GlobalDependencyRegistry extends EagerRegistry { |
| 2049 final Compiler compiler; |
| 2048 Setlet<Element> _otherDependencies; | 2050 Setlet<Element> _otherDependencies; |
| 2049 | 2051 |
| 2050 GlobalDependencyRegistry(Compiler compiler) | 2052 GlobalDependencyRegistry(this.compiler) : super('GlobalDependencies', null); |
| 2051 : super(compiler, new TreeElementMapping(null)); | 2053 |
| 2054 // TODO(johnniwinther): Rename world/universe/enqueuer through out the |
| 2055 // compiler. |
| 2056 @override |
| 2057 Enqueuer get world => compiler.enqueuer.codegen; |
| 2052 | 2058 |
| 2053 void registerDependency(Element element) { | 2059 void registerDependency(Element element) { |
| 2054 if (element == null) return; | 2060 if (element == null) return; |
| 2055 if (_otherDependencies == null) { | 2061 if (_otherDependencies == null) { |
| 2056 _otherDependencies = new Setlet<Element>(); | 2062 _otherDependencies = new Setlet<Element>(); |
| 2057 } | 2063 } |
| 2058 _otherDependencies.add(element.implementation); | 2064 _otherDependencies.add(element.implementation); |
| 2059 } | 2065 } |
| 2060 | 2066 |
| 2061 Iterable<Element> get otherDependencies { | 2067 Iterable<Element> get otherDependencies { |
| 2062 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2068 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
| 2063 } | 2069 } |
| 2064 } | 2070 } |
| OLD | NEW |