OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
6 | 6 |
7 import '../js_emitter.dart' show computeMixinClass, Emitter; | 7 import '../js_emitter.dart' show computeMixinClass, Emitter; |
8 import '../model.dart'; | 8 import '../model.dart'; |
9 | 9 |
10 import '../../common.dart'; | 10 import '../../common.dart'; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // happens when the deferred code is dead-code eliminated but we still need | 92 // happens when the deferred code is dead-code eliminated but we still need |
93 // to check that the library has been loaded. | 93 // to check that the library has been loaded. |
94 _compiler.deferredLoadTask.allOutputUnits.forEach( | 94 _compiler.deferredLoadTask.allOutputUnits.forEach( |
95 _registry.registerOutputUnit); | 95 _registry.registerOutputUnit); |
96 collector.outputClassLists.forEach(_registry.registerElements); | 96 collector.outputClassLists.forEach(_registry.registerElements); |
97 collector.outputStaticLists.forEach(_registry.registerElements); | 97 collector.outputStaticLists.forEach(_registry.registerElements); |
98 collector.outputConstantLists.forEach(_registerConstants); | 98 collector.outputConstantLists.forEach(_registerConstants); |
99 collector.outputStaticNonFinalFieldLists.forEach( | 99 collector.outputStaticNonFinalFieldLists.forEach( |
100 _registry.registerElements); | 100 _registry.registerElements); |
101 | 101 |
102 // TODO(kasperl): There's code that implicitly needs access to the special | 102 // We always add the current isolate holder. |
103 // $ holder so we have to register that. Can we track if we have to? | 103 _registry.registerHolder( |
104 _registry.registerHolder(r'$'); | 104 namer.staticStateHolder, isStaticStateHolder: true); |
105 | 105 |
106 // We need to run the native-preparation before we build the output. The | 106 // We need to run the native-preparation before we build the output. The |
107 // preparation code, in turn needs the classes to be set up. | 107 // preparation code, in turn needs the classes to be set up. |
108 // We thus build the classes before building their containers. | 108 // We thus build the classes before building their containers. |
109 collector.outputClassLists.forEach((OutputUnit _, List<ClassElement> classes
) { | 109 collector.outputClassLists.forEach((OutputUnit _, List<ClassElement> classes
) { |
110 classes.forEach(_buildClass); | 110 classes.forEach(_buildClass); |
111 }); | 111 }); |
112 | 112 |
113 // Resolve the superclass references after we've processed all the classes. | 113 // Resolve the superclass references after we've processed all the classes. |
114 _classes.forEach((ClassElement element, Class c) { | 114 _classes.forEach((ClassElement element, Class c) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 _registry.registerConstant(outputUnit, constantValue); | 790 _registry.registerConstant(outputUnit, constantValue); |
791 assert(!_constants.containsKey(constantValue)); | 791 assert(!_constants.containsKey(constantValue)); |
792 js.Name name = namer.constantName(constantValue); | 792 js.Name name = namer.constantName(constantValue); |
793 String constantObject = namer.globalObjectForConstant(constantValue); | 793 String constantObject = namer.globalObjectForConstant(constantValue); |
794 Holder holder = _registry.registerHolder(constantObject); | 794 Holder holder = _registry.registerHolder(constantObject); |
795 Constant constant = new Constant(name, holder, constantValue); | 795 Constant constant = new Constant(name, holder, constantValue); |
796 _constants[constantValue] = constant; | 796 _constants[constantValue] = constant; |
797 } | 797 } |
798 } | 798 } |
799 } | 799 } |
OLD | NEW |