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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
9 * compiled. | 9 * compiled. |
10 */ | 10 */ |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 assert(invariant(element, resolutionTree != null, | 78 assert(invariant(element, resolutionTree != null, |
79 message: 'Resolution tree is null for $element in codegen work item')); | 79 message: 'Resolution tree is null for $element in codegen work item')); |
80 } | 80 } |
81 | 81 |
82 void run(Compiler compiler, CodegenEnqueuer world) { | 82 void run(Compiler compiler, CodegenEnqueuer world) { |
83 if (world.isProcessed(element)) return; | 83 if (world.isProcessed(element)) return; |
84 compiler.codegen(this, world); | 84 compiler.codegen(this, world); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 typedef void PostProcess(); | |
ahe
2013/04/02 08:22:39
I'd call this PostProcessAction or VoidFunction.
Johnni Winther
2013/04/02 09:40:14
PostProcessAction it is.
| |
89 | |
90 class PostProcessing { | |
ahe
2013/04/02 08:22:39
I'd call this PostProcessTask.
Johnni Winther
2013/04/02 09:40:14
Done.
| |
91 final Element element; | |
92 final PostProcess process; | |
93 | |
94 PostProcessing(this.element, this.process); | |
95 } | |
96 | |
88 class ReadingFilesTask extends CompilerTask { | 97 class ReadingFilesTask extends CompilerTask { |
89 ReadingFilesTask(Compiler compiler) : super(compiler); | 98 ReadingFilesTask(Compiler compiler) : super(compiler); |
90 String get name => 'Reading input files'; | 99 String get name => 'Reading input files'; |
91 } | 100 } |
92 | 101 |
93 abstract class Backend { | 102 abstract class Backend { |
94 final Compiler compiler; | 103 final Compiler compiler; |
95 final ConstantSystem constantSystem; | 104 final ConstantSystem constantSystem; |
96 | 105 |
97 Backend(this.compiler, | 106 Backend(this.compiler, |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 void processQueue(Enqueuer world, Element main) { | 837 void processQueue(Enqueuer world, Element main) { |
829 world.nativeEnqueuer.processNativeClasses(libraries.values); | 838 world.nativeEnqueuer.processNativeClasses(libraries.values); |
830 if (main != null) { | 839 if (main != null) { |
831 world.addToWorkList(main); | 840 world.addToWorkList(main); |
832 } | 841 } |
833 progress.reset(); | 842 progress.reset(); |
834 world.forEach((WorkItem work) { | 843 world.forEach((WorkItem work) { |
835 withCurrentElement(work.element, () => work.run(this, world)); | 844 withCurrentElement(work.element, () => work.run(this, world)); |
836 }); | 845 }); |
837 world.queueIsClosed = true; | 846 world.queueIsClosed = true; |
847 world.forEachPostProcessing((PostProcessing work) { | |
848 withCurrentElement(work.element, () => work.process()); | |
849 }); | |
838 if (compilationFailed) return; | 850 if (compilationFailed) return; |
839 assert(world.checkNoEnqueuedInvokedInstanceMethods()); | 851 assert(world.checkNoEnqueuedInvokedInstanceMethods()); |
840 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) { | 852 if (DUMP_INFERRED_TYPES && phase == PHASE_COMPILING) { |
841 backend.dumpInferredTypes(); | 853 backend.dumpInferredTypes(); |
842 } | 854 } |
843 } | 855 } |
844 | 856 |
845 /** | 857 /** |
846 * Perform various checks of the queues. This includes checking that | 858 * Perform various checks of the queues. This includes checking that |
847 * the queues are empty (nothing was added after we stopped | 859 * the queues are empty (nothing was added after we stopped |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1263 | 1275 |
1264 void close() {} | 1276 void close() {} |
1265 | 1277 |
1266 toString() => name; | 1278 toString() => name; |
1267 | 1279 |
1268 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1280 /// Convenience method for getting an [api.CompilerOutputProvider]. |
1269 static NullSink outputProvider(String name, String extension) { | 1281 static NullSink outputProvider(String name, String extension) { |
1270 return new NullSink('$name.$extension'); | 1282 return new NullSink('$name.$extension'); |
1271 } | 1283 } |
1272 } | 1284 } |
OLD | NEW |