| 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 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
| 8 show | 8 show |
| 9 CREATE_NEW_ISOLATE, | 9 CREATE_NEW_ISOLATE, |
| 10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); | 164 program.finalizers.forEach((js.TokenFinalizer f) => f.finalizeTokens()); |
| 165 | 165 |
| 166 // TODO(johnniwinther): Support source maps in this emitter. | 166 // TODO(johnniwinther): Support source maps in this emitter. |
| 167 for (int i = 0; i < fragmentsCode.length; ++i) { | 167 for (int i = 0; i < fragmentsCode.length; ++i) { |
| 168 String code = js | 168 String code = js |
| 169 .createCodeBuffer(fragmentsCode[i], compiler.options, | 169 .createCodeBuffer(fragmentsCode[i], compiler.options, |
| 170 backend.sourceInformationStrategy) | 170 backend.sourceInformationStrategy) |
| 171 .getText(); | 171 .getText(); |
| 172 totalSize += code.length; | 172 totalSize += code.length; |
| 173 compiler.outputProvider( | 173 compiler.outputProvider.createOutputSink( |
| 174 fragments[i + 1].outputFileName, deferredExtension, OutputType.jsPart) | 174 fragments[i + 1].outputFileName, deferredExtension, OutputType.jsPart) |
| 175 ..add(code) | 175 ..add(code) |
| 176 ..close(); | 176 ..close(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 String mainCode = js | 179 String mainCode = js |
| 180 .createCodeBuffer( | 180 .createCodeBuffer( |
| 181 mainAst, compiler.options, backend.sourceInformationStrategy) | 181 mainAst, compiler.options, backend.sourceInformationStrategy) |
| 182 .getText(); | 182 .getText(); |
| 183 compiler.outputProvider(mainFragment.outputFileName, 'js', OutputType.js) | 183 compiler.outputProvider |
| 184 ..add(buildGeneratedBy(compiler)) | 184 .createOutputSink(mainFragment.outputFileName, 'js', OutputType.js) |
| 185 ..add(mainCode) | 185 ..add(buildGeneratedBy(compiler)) |
| 186 ..close(); | 186 ..add(mainCode) |
| 187 ..close(); |
| 187 totalSize += mainCode.length; | 188 totalSize += mainCode.length; |
| 188 | 189 |
| 189 return totalSize; | 190 return totalSize; |
| 190 } | 191 } |
| 191 | 192 |
| 192 /// Returns a [js.Literal] that represents the string result of unparsing | 193 /// Returns a [js.Literal] that represents the string result of unparsing |
| 193 /// [value]. | 194 /// [value]. |
| 194 /// | 195 /// |
| 195 /// The returned node will, when its string value is requested, pretty-print | 196 /// The returned node will, when its string value is requested, pretty-print |
| 196 /// the given [value] and, if [protectForEval] is true, wrap the resulting | 197 /// the given [value] and, if [protectForEval] is true, wrap the resulting |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 #eagerClasses; | 1283 #eagerClasses; |
| 1283 | 1284 |
| 1284 var end = Date.now(); | 1285 var end = Date.now(); |
| 1285 // print('Setup: ' + (end - start) + ' ms.'); | 1286 // print('Setup: ' + (end - start) + ' ms.'); |
| 1286 | 1287 |
| 1287 #invokeMain; // Start main. | 1288 #invokeMain; // Start main. |
| 1288 | 1289 |
| 1289 })(Date.now(), #code) | 1290 })(Date.now(), #code) |
| 1290 }"""; | 1291 }"""; |
| 1291 } | 1292 } |
| OLD | NEW |