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.full_emitter; | 5 library dart2js.js_emitter.full_emitter; |
6 | 6 |
7 import 'dart:collection' show HashMap; | 7 import 'dart:collection' show HashMap; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 List<CodeOutputListener> codeOutputListeners; | 1528 List<CodeOutputListener> codeOutputListeners; |
1529 if (generateSourceMap) { | 1529 if (generateSourceMap) { |
1530 locationCollector = new LocationCollector(); | 1530 locationCollector = new LocationCollector(); |
1531 codeOutputListeners = <CodeOutputListener>[locationCollector]; | 1531 codeOutputListeners = <CodeOutputListener>[locationCollector]; |
1532 } | 1532 } |
1533 | 1533 |
1534 CodeOutput mainOutput = new StreamCodeOutput( | 1534 CodeOutput mainOutput = new StreamCodeOutput( |
1535 compiler.outputProvider('', 'js', OutputType.js), codeOutputListeners); | 1535 compiler.outputProvider('', 'js', OutputType.js), codeOutputListeners); |
1536 outputBuffers[mainOutputUnit] = mainOutput; | 1536 outputBuffers[mainOutputUnit] = mainOutput; |
1537 | 1537 |
1538 mainOutput.addBuffer(jsAst.createCodeBuffer(program, compiler, | 1538 mainOutput.addBuffer(jsAst.createCodeBuffer( |
| 1539 program, compiler.options, backend.sourceInformationStrategy, |
1539 monitor: compiler.dumpInfoTask)); | 1540 monitor: compiler.dumpInfoTask)); |
1540 | 1541 |
1541 if (compiler.options.deferredMapUri != null) { | 1542 if (compiler.options.deferredMapUri != null) { |
1542 outputDeferredMap(); | 1543 outputDeferredMap(); |
1543 } | 1544 } |
1544 | 1545 |
1545 if (generateSourceMap) { | 1546 if (generateSourceMap) { |
1546 mainOutput.add(SourceMapBuilder.generateSourceMapTag( | 1547 mainOutput.add(SourceMapBuilder.generateSourceMapTag( |
1547 compiler.options.sourceMapUri, compiler.options.outputUri)); | 1548 compiler.options.sourceMapUri, compiler.options.outputUri)); |
1548 } | 1549 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 } | 1863 } |
1863 | 1864 |
1864 String partPrefix = | 1865 String partPrefix = |
1865 backend.deferredPartFileName(outputUnit.name, addExtension: false); | 1866 backend.deferredPartFileName(outputUnit.name, addExtension: false); |
1866 CodeOutput output = new StreamCodeOutput( | 1867 CodeOutput output = new StreamCodeOutput( |
1867 compiler.outputProvider(partPrefix, 'part.js', OutputType.jsPart), | 1868 compiler.outputProvider(partPrefix, 'part.js', OutputType.jsPart), |
1868 outputListeners); | 1869 outputListeners); |
1869 | 1870 |
1870 outputBuffers[outputUnit] = output; | 1871 outputBuffers[outputUnit] = output; |
1871 | 1872 |
1872 output.addBuffer(jsAst.createCodeBuffer(outputAsts[outputUnit], compiler, | 1873 output.addBuffer(jsAst.createCodeBuffer(outputAsts[outputUnit], |
| 1874 compiler.options, backend.sourceInformationStrategy, |
1873 monitor: compiler.dumpInfoTask)); | 1875 monitor: compiler.dumpInfoTask)); |
1874 | 1876 |
1875 // Make a unique hash of the code (before the sourcemaps are added) | 1877 // Make a unique hash of the code (before the sourcemaps are added) |
1876 // This will be used to retrieve the initializing function from the global | 1878 // This will be used to retrieve the initializing function from the global |
1877 // variable. | 1879 // variable. |
1878 String hash = hasher.getHash(); | 1880 String hash = hasher.getHash(); |
1879 | 1881 |
1880 output.add('$N${deferredInitializers}["$hash"]$_=$_' | 1882 output.add('$N${deferredInitializers}["$hash"]$_=$_' |
1881 '${deferredInitializers}.current$N'); | 1883 '${deferredInitializers}.current$N'); |
1882 | 1884 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 // data. | 1931 // data. |
1930 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 1932 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
1931 "needed for a given deferred library import."; | 1933 "needed for a given deferred library import."; |
1932 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 1934 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
1933 compiler.outputProvider( | 1935 compiler.outputProvider( |
1934 compiler.options.deferredMapUri.path, '', OutputType.info) | 1936 compiler.options.deferredMapUri.path, '', OutputType.info) |
1935 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 1937 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
1936 ..close(); | 1938 ..close(); |
1937 } | 1939 } |
1938 } | 1940 } |
OLD | NEW |