| 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.lazy_emitter.model_emitter; | 5 library dart2js.js_emitter.lazy_emitter.model_emitter; |
| 6 | 6 |
| 7 import '../../compiler.dart' show | 7 import '../../compiler.dart' show |
| 8 Compiler; | 8 Compiler; |
| 9 import '../../constants/values.dart' show | 9 import '../../constants/values.dart' show |
| 10 ConstantValue, | 10 ConstantValue, |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 }).toList(); | 152 }).toList(); |
| 153 | 153 |
| 154 js.Statement mainAst = emitMainFragment(program); | 154 js.Statement mainAst = emitMainFragment(program); |
| 155 | 155 |
| 156 js.TokenCounter counter = new js.TokenCounter(); | 156 js.TokenCounter counter = new js.TokenCounter(); |
| 157 fragmentsCode.forEach(counter.countTokens); | 157 fragmentsCode.forEach(counter.countTokens); |
| 158 counter.countTokens(mainAst); | 158 counter.countTokens(mainAst); |
| 159 | 159 |
| 160 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); | 160 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); |
| 161 | 161 |
| 162 // TODO(johnnniwinther): Support source maps in this emitter. |
| 162 for (int i = 0; i < fragmentsCode.length; ++i) { | 163 for (int i = 0; i < fragmentsCode.length; ++i) { |
| 163 String code = js.prettyPrint(fragmentsCode[i], compiler).getText(); | 164 String code = js.createCodeBuffer(fragmentsCode[i], compiler).getText(); |
| 164 totalSize += code.length; | 165 totalSize += code.length; |
| 165 compiler.outputProvider(fragments[i+1].outputFileName, deferredExtension) | 166 compiler.outputProvider(fragments[i+1].outputFileName, deferredExtension) |
| 166 ..add(code) | 167 ..add(code) |
| 167 ..close(); | 168 ..close(); |
| 168 } | 169 } |
| 169 | 170 |
| 170 String mainCode = js.prettyPrint(mainAst, compiler).getText(); | 171 String mainCode = js.createCodeBuffer(mainAst, compiler).getText(); |
| 171 compiler.outputProvider(mainFragment.outputFileName, 'js') | 172 compiler.outputProvider(mainFragment.outputFileName, 'js') |
| 172 ..add(buildGeneratedBy(compiler)) | 173 ..add(buildGeneratedBy(compiler)) |
| 173 ..add(mainCode) | 174 ..add(mainCode) |
| 174 ..close(); | 175 ..close(); |
| 175 totalSize += mainCode.length; | 176 totalSize += mainCode.length; |
| 176 | 177 |
| 177 return totalSize; | 178 return totalSize; |
| 178 } | 179 } |
| 179 | 180 |
| 180 /// Returns a [js.Literal] that represents the string result of unparsing | 181 /// Returns a [js.Literal] that represents the string result of unparsing |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 | 1250 |
| 1250 var end = Date.now(); | 1251 var end = Date.now(); |
| 1251 // print('Setup: ' + (end - start) + ' ms.'); | 1252 // print('Setup: ' + (end - start) + ' ms.'); |
| 1252 | 1253 |
| 1253 #invokeMain; // Start main. | 1254 #invokeMain; // Start main. |
| 1254 | 1255 |
| 1255 })(Date.now(), #code) | 1256 })(Date.now(), #code) |
| 1256 }"""; | 1257 }"""; |
| 1257 | 1258 |
| 1258 } | 1259 } |
| OLD | NEW |