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

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

Issue 1405563002: Move otherDependencies to globalDependencies. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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) 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
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 */ 151 */
152 final TokenMap commentMap = new TokenMap(); 152 final TokenMap commentMap = new TokenMap();
153 153
154 /** 154 /**
155 * Records global dependencies, that is, dependencies that don't 155 * Records global dependencies, that is, dependencies that don't
156 * correspond to a particular element. 156 * correspond to a particular element.
157 * 157 *
158 * We should get rid of this and ensure that all dependencies are 158 * We should get rid of this and ensure that all dependencies are
159 * associated with a particular element. 159 * associated with a particular element.
160 */ 160 */
161 Registry globalDependencies; 161 GlobalDependencyRegistry globalDependencies;
162 162
163 /** 163 /**
164 * Dependencies that are only included due to mirrors. 164 * Dependencies that are only included due to mirrors.
165 * 165 *
166 * We should get rid of this and ensure that all dependencies are 166 * We should get rid of this and ensure that all dependencies are
167 * associated with a particular element. 167 * associated with a particular element.
168 */ 168 */
169 // TODO(johnniwinther): This should not be a [ResolutionRegistry]. 169 // TODO(johnniwinther): This should not be a [ResolutionRegistry].
170 final Registry mirrorDependencies = 170 final Registry mirrorDependencies =
171 new ResolutionRegistry(null, new TreeElementMapping(null)); 171 new ResolutionRegistry(null, new TreeElementMapping(null));
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 _coreTypes = new _CompilerCoreTypes(_resolution); 488 _coreTypes = new _CompilerCoreTypes(_resolution);
489 types = new Types(_resolution); 489 types = new Types(_resolution);
490 tracer = new Tracer(this, this.outputProvider); 490 tracer = new Tracer(this, this.outputProvider);
491 491
492 if (verbose) { 492 if (verbose) {
493 progress = new Stopwatch()..start(); 493 progress = new Stopwatch()..start();
494 } 494 }
495 495
496 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing 496 // TODO(johnniwinther): Separate the dependency tracking from the enqueuing
497 // for global dependencies. 497 // for global dependencies.
498 globalDependencies = 498 globalDependencies = new GlobalDependencyRegistry(this);
499 new CodegenRegistry(this, new TreeElementMapping(null));
500 499
501 if (emitJavaScript) { 500 if (emitJavaScript) {
502 js_backend.JavaScriptBackend jsBackend = 501 js_backend.JavaScriptBackend jsBackend =
503 new js_backend.JavaScriptBackend( 502 new js_backend.JavaScriptBackend(
504 this, generateSourceMap: generateSourceMap, 503 this, generateSourceMap: generateSourceMap,
505 useStartupEmitter: useStartupEmitter); 504 useStartupEmitter: useStartupEmitter);
506 backend = jsBackend; 505 backend = jsBackend;
507 } else { 506 } else {
508 backend = new dart_backend.DartBackend(this, strips, 507 backend = new dart_backend.DartBackend(this, strips,
509 multiFile: dart2dartMultiFile); 508 multiFile: dart2dartMultiFile);
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 2022
2024 @override 2023 @override
2025 void parsePatchClass(ClassElement cls) { 2024 void parsePatchClass(ClassElement cls) {
2026 compiler.patchParser.measure(() { 2025 compiler.patchParser.measure(() {
2027 if (cls.isPatch) { 2026 if (cls.isPatch) {
2028 compiler.patchParser.parsePatchClassNode(cls); 2027 compiler.patchParser.parsePatchClassNode(cls);
2029 } 2028 }
2030 }); 2029 });
2031 } 2030 }
2032 } 2031 }
2032
2033 class GlobalDependencyRegistry extends CodegenRegistry {
2034 Setlet<Element> _otherDependencies;
2035
2036 GlobalDependencyRegistry(Compiler compiler)
2037 : super(compiler, new TreeElementMapping(null));
2038
2039 void registerDependency(Element element) {
2040 if (element == null) return;
2041 if (_otherDependencies == null) {
2042 _otherDependencies = new Setlet<Element>();
2043 }
2044 _otherDependencies.add(element.implementation);
2045 }
2046
2047 Iterable<Element> get otherDependencies {
2048 return _otherDependencies != null ? _otherDependencies : const <Element>[];
2049 }
2050 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/registry.dart ('k') | pkg/compiler/lib/src/resolution/registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698