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 // 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 part of dart2js.js_emitter.program_builder; | 5 part of dart2js.js_emitter.program_builder; |
6 | 6 |
7 /** | 7 /** |
8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
10 * | 10 * |
11 * The code for the containing (used) methods must exist in the `universe`. | 11 * The code for the containing (used) methods must exist in the `universe`. |
12 */ | 12 */ |
13 class Collector { | 13 class Collector { |
14 final CompilerOptions _options; | 14 final CompilerOptions _options; |
15 final CommonElements _commonElements; | 15 final CommonElements _commonElements; |
16 final DeferredLoadTask _deferredLoadTask; | 16 final DeferredLoadTask _deferredLoadTask; |
17 final CodegenWorldBuilder _worldBuilder; | 17 final CodegenWorldBuilder _worldBuilder; |
18 // TODO(floitsch): the code-emitter task should not need a namer. | 18 // TODO(floitsch): the code-emitter task should not need a namer. |
19 final Namer _namer; | 19 final Namer _namer; |
20 final Emitter _emitter; | 20 final Emitter _emitter; |
21 final JavaScriptConstantCompiler _constantHandler; | 21 final JavaScriptConstantCompiler _constantHandler; |
22 final NativeData _nativeData; | 22 final NativeData _nativeData; |
23 final InterceptorData _interceptorData; | 23 final InterceptorData _interceptorData; |
24 final OneShotInterceptorData _oneShotInterceptorData; | 24 final OneShotInterceptorData _oneShotInterceptorData; |
25 final MirrorsData _mirrorsData; | 25 final MirrorsData _mirrorsData; |
26 final ClosedWorld _closedWorld; | 26 final ClosedWorld _closedWorld; |
27 final Set<ClassEntity> _rtiNeededClasses; | 27 final Set<ClassEntity> _rtiNeededClasses; |
28 final Map<MemberElement, js.Expression> _generatedCode; | 28 final Map<MemberEntity, js.Expression> _generatedCode; |
29 final Sorter _sorter; | 29 final Sorter _sorter; |
30 | 30 |
31 final Set<ClassEntity> neededClasses = new Set<ClassEntity>(); | 31 final Set<ClassEntity> neededClasses = new Set<ClassEntity>(); |
32 // This field is set in [computeNeededDeclarations]. | 32 // This field is set in [computeNeededDeclarations]. |
33 Set<ClassEntity> classesOnlyNeededForRti; | 33 Set<ClassEntity> classesOnlyNeededForRti; |
34 final Map<OutputUnit, List<ClassEntity>> outputClassLists = | 34 final Map<OutputUnit, List<ClassEntity>> outputClassLists = |
35 new Map<OutputUnit, List<ClassEntity>>(); | 35 new Map<OutputUnit, List<ClassEntity>>(); |
36 final Map<OutputUnit, List<ConstantValue>> outputConstantLists = | 36 final Map<OutputUnit, List<ConstantValue>> outputConstantLists = |
37 new Map<OutputUnit, List<ConstantValue>>(); | 37 new Map<OutputUnit, List<ConstantValue>>(); |
38 final Map<OutputUnit, List<MemberEntity>> outputStaticLists = | 38 final Map<OutputUnit, List<MemberEntity>> outputStaticLists = |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 | 356 |
357 void collect() { | 357 void collect() { |
358 computeNeededDeclarations(); | 358 computeNeededDeclarations(); |
359 computeNeededConstants(); | 359 computeNeededConstants(); |
360 computeNeededStatics(); | 360 computeNeededStatics(); |
361 computeNeededStaticNonFinalFields(); | 361 computeNeededStaticNonFinalFields(); |
362 computeNeededLibraries(); | 362 computeNeededLibraries(); |
363 } | 363 } |
364 } | 364 } |
OLD | NEW |