| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
| 9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
| 10 * | 10 * |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 precompiledFunctionAst, compiler, | 1616 precompiledFunctionAst, compiler, |
| 1617 allowVariableMinification: false).getText()); | 1617 allowVariableMinification: false).getText()); |
| 1618 | 1618 |
| 1619 compiler.outputProvider('', 'precompiled.js') | 1619 compiler.outputProvider('', 'precompiled.js') |
| 1620 ..add(mainBuffer.getText()) | 1620 ..add(mainBuffer.getText()) |
| 1621 ..close(); | 1621 ..close(); |
| 1622 } | 1622 } |
| 1623 emitDeferredCode(); | 1623 emitDeferredCode(); |
| 1624 | 1624 |
| 1625 }); | 1625 }); |
| 1626 // Write collected information to database. |
| 1627 EventSink<String> sink = compiler.outputProvider("dart", "pl"); |
| 1628 prolog.ProgramEmitter emitter = new prolog.ProgramEmitter(sink); |
| 1629 prolog.ProgramBuilder builder = new prolog.ProgramBuilder(); |
| 1630 // TODO(karlklose): use only one Relations. |
| 1631 [compiler.enqueuer.resolution, compiler.enqueuer.codegen].forEach((e) { |
| 1632 Relations dep = e.dependencies; |
| 1633 dep.finalizeInformation(compiler); |
| 1634 for (String name in dep.links.keys) { |
| 1635 Map relation = dep.links[name]; |
| 1636 for (var source in relation.keys) { |
| 1637 for (var target in relation[source]) { |
| 1638 builder.addRelation('${dep.prefix}_$name', [source, target]); |
| 1639 } |
| 1640 } |
| 1641 } |
| 1642 }); |
| 1643 emitter.emitProgram(builder.program); |
| 1644 |
| 1626 return compiler.assembledCode; | 1645 return compiler.assembledCode; |
| 1627 } | 1646 } |
| 1628 | 1647 |
| 1629 String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) { | 1648 String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) { |
| 1630 if (sourceMapUri != null && fileUri != null) { | 1649 if (sourceMapUri != null && fileUri != null) { |
| 1631 // Using # is the new proposed standard. @ caused problems in Internet | 1650 // Using # is the new proposed standard. @ caused problems in Internet |
| 1632 // Explorer due to "Conditional Compilation Statements" in JScript, | 1651 // Explorer due to "Conditional Compilation Statements" in JScript, |
| 1633 // see: | 1652 // see: |
| 1634 // http://msdn.microsoft.com/en-us/library/7kx09ct1(v=vs.80).aspx | 1653 // http://msdn.microsoft.com/en-us/library/7kx09ct1(v=vs.80).aspx |
| 1635 // About source maps, see: | 1654 // About source maps, see: |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 String sourceMap = sourceMapBuilder.build(); | 1768 String sourceMap = sourceMapBuilder.build(); |
| 1750 compiler.outputProvider(name, 'js.map') | 1769 compiler.outputProvider(name, 'js.map') |
| 1751 ..add(sourceMap) | 1770 ..add(sourceMap) |
| 1752 ..close(); | 1771 ..close(); |
| 1753 } | 1772 } |
| 1754 | 1773 |
| 1755 void registerReadTypeVariable(TypeVariableElement element) { | 1774 void registerReadTypeVariable(TypeVariableElement element) { |
| 1756 readTypeVariables.add(element); | 1775 readTypeVariables.add(element); |
| 1757 } | 1776 } |
| 1758 } | 1777 } |
| OLD | NEW |