| 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 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 new Map<String, List<jsAst.LiteralString>>(); | 1727 new Map<String, List<jsAst.LiteralString>>(); |
| 1728 Map<String, List<_DeferredOutputUnitHash>> deferredLibraryHashes = | 1728 Map<String, List<_DeferredOutputUnitHash>> deferredLibraryHashes = |
| 1729 new Map<String, List<_DeferredOutputUnitHash>>(); | 1729 new Map<String, List<_DeferredOutputUnitHash>>(); |
| 1730 compiler.deferredLoadTask.hunksToLoad | 1730 compiler.deferredLoadTask.hunksToLoad |
| 1731 .forEach((String loadId, List<OutputUnit> outputUnits) { | 1731 .forEach((String loadId, List<OutputUnit> outputUnits) { |
| 1732 List<jsAst.LiteralString> uris = new List<jsAst.LiteralString>(); | 1732 List<jsAst.LiteralString> uris = new List<jsAst.LiteralString>(); |
| 1733 List<_DeferredOutputUnitHash> hashes = | 1733 List<_DeferredOutputUnitHash> hashes = |
| 1734 new List<_DeferredOutputUnitHash>(); | 1734 new List<_DeferredOutputUnitHash>(); |
| 1735 deferredLibraryHashes[loadId] = new List<_DeferredOutputUnitHash>(); | 1735 deferredLibraryHashes[loadId] = new List<_DeferredOutputUnitHash>(); |
| 1736 for (OutputUnit outputUnit in outputUnits) { | 1736 for (OutputUnit outputUnit in outputUnits) { |
| 1737 uris.add( | 1737 uris.add(js.escapedString( |
| 1738 js.escapedString(backend.deferredPartFileName(outputUnit.name))); | 1738 compiler.deferredLoadTask.deferredPartFileName(outputUnit.name))); |
| 1739 hashes.add(deferredLoadHashes[outputUnit]); | 1739 hashes.add(deferredLoadHashes[outputUnit]); |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 deferredLibraryUris[loadId] = uris; | 1742 deferredLibraryUris[loadId] = uris; |
| 1743 deferredLibraryHashes[loadId] = hashes; | 1743 deferredLibraryHashes[loadId] = hashes; |
| 1744 }); | 1744 }); |
| 1745 | 1745 |
| 1746 void emitMapping(String name, Map<String, List<jsAst.Expression>> mapping) { | 1746 void emitMapping(String name, Map<String, List<jsAst.Expression>> mapping) { |
| 1747 List<jsAst.Property> properties = new List<jsAst.Property>(); | 1747 List<jsAst.Property> properties = new List<jsAst.Property>(); |
| 1748 mapping.forEach((String key, List<jsAst.Expression> values) { | 1748 mapping.forEach((String key, List<jsAst.Expression> values) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 List<CodeOutputListener> outputListeners = <CodeOutputListener>[]; | 1854 List<CodeOutputListener> outputListeners = <CodeOutputListener>[]; |
| 1855 Hasher hasher = new Hasher(); | 1855 Hasher hasher = new Hasher(); |
| 1856 outputListeners.add(hasher); | 1856 outputListeners.add(hasher); |
| 1857 | 1857 |
| 1858 LocationCollector locationCollector; | 1858 LocationCollector locationCollector; |
| 1859 if (generateSourceMap) { | 1859 if (generateSourceMap) { |
| 1860 locationCollector = new LocationCollector(); | 1860 locationCollector = new LocationCollector(); |
| 1861 outputListeners.add(locationCollector); | 1861 outputListeners.add(locationCollector); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 String partPrefix = | 1864 String partPrefix = compiler.deferredLoadTask |
| 1865 backend.deferredPartFileName(outputUnit.name, addExtension: false); | 1865 .deferredPartFileName(outputUnit.name, addExtension: false); |
| 1866 CodeOutput output = new StreamCodeOutput( | 1866 CodeOutput output = new StreamCodeOutput( |
| 1867 compiler.outputProvider(partPrefix, 'part.js', OutputType.jsPart), | 1867 compiler.outputProvider(partPrefix, 'part.js', OutputType.jsPart), |
| 1868 outputListeners); | 1868 outputListeners); |
| 1869 | 1869 |
| 1870 outputBuffers[outputUnit] = output; | 1870 outputBuffers[outputUnit] = output; |
| 1871 | 1871 |
| 1872 output.addBuffer(jsAst.createCodeBuffer(outputAsts[outputUnit], | 1872 output.addBuffer(jsAst.createCodeBuffer(outputAsts[outputUnit], |
| 1873 compiler.options, backend.sourceInformationStrategy, | 1873 compiler.options, backend.sourceInformationStrategy, |
| 1874 monitor: compiler.dumpInfoTask)); | 1874 monitor: compiler.dumpInfoTask)); |
| 1875 | 1875 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 // data. | 1930 // data. |
| 1931 mapping["_comment"] = "This mapping shows which compiled `.js` files are " | 1931 mapping["_comment"] = "This mapping shows which compiled `.js` files are " |
| 1932 "needed for a given deferred library import."; | 1932 "needed for a given deferred library import."; |
| 1933 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); | 1933 mapping.addAll(compiler.deferredLoadTask.computeDeferredMap()); |
| 1934 compiler.outputProvider( | 1934 compiler.outputProvider( |
| 1935 compiler.options.deferredMapUri.path, '', OutputType.info) | 1935 compiler.options.deferredMapUri.path, '', OutputType.info) |
| 1936 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) | 1936 ..add(const JsonEncoder.withIndent(" ").convert(mapping)) |
| 1937 ..close(); | 1937 ..close(); |
| 1938 } | 1938 } |
| 1939 } | 1939 } |
| OLD | NEW |