| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 backend.emitter.staticFunctionAccess(_compiler.mainFunction), | 121 backend.emitter.staticFunctionAccess(_compiler.mainFunction), |
| 122 _buildLibraries(fragment), | 122 _buildLibraries(fragment), |
| 123 _buildStaticNonFinalFields(fragment), | 123 _buildStaticNonFinalFields(fragment), |
| 124 _buildStaticLazilyInitializedFields(fragment), | 124 _buildStaticLazilyInitializedFields(fragment), |
| 125 _buildConstants(fragment), | 125 _buildConstants(fragment), |
| 126 _registry.holders.toList(growable: false)); | 126 _registry.holders.toList(growable: false)); |
| 127 _outputs[fragment.outputUnit] = result; | 127 _outputs[fragment.outputUnit] = result; |
| 128 return result; | 128 return result; |
| 129 } | 129 } |
| 130 | 130 |
| 131 /// Returns a name composed of the main output file name and [name]. | |
| 132 String _outputFileName(String name) { | |
| 133 assert(name != ""); | |
| 134 String outPath = _compiler.outputUri != null | |
| 135 ? _compiler.outputUri.path | |
| 136 : "out"; | |
| 137 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); | |
| 138 return "${outName}_$name"; | |
| 139 } | |
| 140 | |
| 141 DeferredOutput _buildDeferredOutput(MainOutput mainOutput, | 131 DeferredOutput _buildDeferredOutput(MainOutput mainOutput, |
| 142 Fragment fragment) { | 132 Fragment fragment) { |
| 143 DeferredOutput result = new DeferredOutput( | 133 DeferredOutput result = new DeferredOutput( |
| 144 _outputFileName(fragment.name), fragment.name, | 134 backend.deferredPartFileName(fragment.name, addExtension: false), |
| 135 fragment.name, |
| 145 mainOutput, | 136 mainOutput, |
| 146 _buildLibraries(fragment), | 137 _buildLibraries(fragment), |
| 147 _buildStaticNonFinalFields(fragment), | 138 _buildStaticNonFinalFields(fragment), |
| 148 _buildStaticLazilyInitializedFields(fragment), | 139 _buildStaticLazilyInitializedFields(fragment), |
| 149 _buildConstants(fragment)); | 140 _buildConstants(fragment)); |
| 150 _outputs[fragment.outputUnit] = result; | 141 _outputs[fragment.outputUnit] = result; |
| 151 return result; | 142 return result; |
| 152 } | 143 } |
| 153 | 144 |
| 154 List<Constant> _buildConstants(Fragment fragment) { | 145 List<Constant> _buildConstants(Fragment fragment) { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 for (ConstantValue constantValue in constantValues) { | 437 for (ConstantValue constantValue in constantValues) { |
| 447 assert(!_constants.containsKey(constantValue)); | 438 assert(!_constants.containsKey(constantValue)); |
| 448 String name = namer.constantName(constantValue); | 439 String name = namer.constantName(constantValue); |
| 449 String constantObject = namer.globalObjectForConstant(constantValue); | 440 String constantObject = namer.globalObjectForConstant(constantValue); |
| 450 Holder holder = _registry.registerHolder(constantObject); | 441 Holder holder = _registry.registerHolder(constantObject); |
| 451 Constant constant = new Constant(name, holder, constantValue); | 442 Constant constant = new Constant(name, holder, constantValue); |
| 452 _constants[constantValue] = constant; | 443 _constants[constantValue] = constant; |
| 453 }; | 444 }; |
| 454 } | 445 } |
| 455 } | 446 } |
| OLD | NEW |