| 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; | 7 import 'js_emitter.dart' show computeMixinClass; |
| 8 import 'model.dart'; | 8 import 'model.dart'; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 backend.emitter.staticFunctionAccess(_compiler.mainFunction), | 119 backend.emitter.staticFunctionAccess(_compiler.mainFunction), |
| 120 _buildLibraries(fragment), | 120 _buildLibraries(fragment), |
| 121 _buildStaticNonFinalFields(fragment), | 121 _buildStaticNonFinalFields(fragment), |
| 122 _buildStaticLazilyInitializedFields(fragment), | 122 _buildStaticLazilyInitializedFields(fragment), |
| 123 _buildConstants(fragment), | 123 _buildConstants(fragment), |
| 124 _registry.holders.toList(growable: false)); | 124 _registry.holders.toList(growable: false)); |
| 125 _outputs[fragment.outputUnit] = result; | 125 _outputs[fragment.outputUnit] = result; |
| 126 return result; | 126 return result; |
| 127 } | 127 } |
| 128 | 128 |
| 129 /// Returns a name composed of the main output file name and [name]. | |
| 130 String _outputFileName(String name) { | |
| 131 assert(name != ""); | |
| 132 String outPath = _compiler.outputUri != null | |
| 133 ? _compiler.outputUri.path | |
| 134 : "out"; | |
| 135 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); | |
| 136 return "${outName}_$name"; | |
| 137 } | |
| 138 | |
| 139 DeferredOutput _buildDeferredOutput(MainOutput mainOutput, | 129 DeferredOutput _buildDeferredOutput(MainOutput mainOutput, |
| 140 Fragment fragment) { | 130 Fragment fragment) { |
| 141 DeferredOutput result = new DeferredOutput( | 131 DeferredOutput result = new DeferredOutput( |
| 142 _outputFileName(fragment.name), fragment.name, | 132 backend.deferredPartFileName(fragment.name, addExtension: false), |
| 133 fragment.name, |
| 143 mainOutput, | 134 mainOutput, |
| 144 _buildLibraries(fragment), | 135 _buildLibraries(fragment), |
| 145 _buildStaticNonFinalFields(fragment), | 136 _buildStaticNonFinalFields(fragment), |
| 146 _buildStaticLazilyInitializedFields(fragment), | 137 _buildStaticLazilyInitializedFields(fragment), |
| 147 _buildConstants(fragment)); | 138 _buildConstants(fragment)); |
| 148 _outputs[fragment.outputUnit] = result; | 139 _outputs[fragment.outputUnit] = result; |
| 149 return result; | 140 return result; |
| 150 } | 141 } |
| 151 | 142 |
| 152 List<Constant> _buildConstants(Fragment fragment) { | 143 List<Constant> _buildConstants(Fragment fragment) { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 for (ConstantValue constantValue in constantValues) { | 408 for (ConstantValue constantValue in constantValues) { |
| 418 assert(!_constants.containsKey(constantValue)); | 409 assert(!_constants.containsKey(constantValue)); |
| 419 String name = namer.constantName(constantValue); | 410 String name = namer.constantName(constantValue); |
| 420 String constantObject = namer.globalObjectForConstant(constantValue); | 411 String constantObject = namer.globalObjectForConstant(constantValue); |
| 421 Holder holder = _registry.registerHolder(constantObject); | 412 Holder holder = _registry.registerHolder(constantObject); |
| 422 Constant constant = new Constant(name, holder, constantValue); | 413 Constant constant = new Constant(name, holder, constantValue); |
| 423 _constants[constantValue] = constant; | 414 _constants[constantValue] = constant; |
| 424 }; | 415 }; |
| 425 } | 416 } |
| 426 } | 417 } |
| OLD | NEW |