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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 return '// Generated by dart2js, the Dart to JavaScript compiler$suffix.\n'; | 1689 return '// Generated by dart2js, the Dart to JavaScript compiler$suffix.\n'; |
1690 } | 1690 } |
1691 | 1691 |
1692 void outputSourceMap(String code, CodeBuffer buffer, String name, | 1692 void outputSourceMap(String code, CodeBuffer buffer, String name, |
1693 [Uri sourceMapUri, Uri fileUri]) { | 1693 [Uri sourceMapUri, Uri fileUri]) { |
1694 if (!generateSourceMap) return; | 1694 if (!generateSourceMap) return; |
1695 // Create a source file for the compilation output. This allows using | 1695 // Create a source file for the compilation output. This allows using |
1696 // [:getLine:] to transform offsets to line numbers in [SourceMapBuilder]. | 1696 // [:getLine:] to transform offsets to line numbers in [SourceMapBuilder]. |
1697 SourceFile compiledFile = new StringSourceFile(null, code); | 1697 SourceFile compiledFile = new StringSourceFile(null, code); |
1698 SourceMapBuilder sourceMapBuilder = | 1698 SourceMapBuilder sourceMapBuilder = |
1699 new SourceMapBuilder(sourceMapUri, fileUri); | 1699 new SourceMapBuilder(sourceMapUri, fileUri, compiledFile); |
1700 buffer.forEachSourceLocation(sourceMapBuilder.addMapping); | 1700 buffer.forEachSourceLocation(sourceMapBuilder.addMapping); |
1701 String sourceMap = sourceMapBuilder.build(compiledFile); | 1701 String sourceMap = sourceMapBuilder.build(); |
1702 compiler.outputProvider(name, 'js.map') | 1702 compiler.outputProvider(name, 'js.map') |
1703 ..add(sourceMap) | 1703 ..add(sourceMap) |
1704 ..close(); | 1704 ..close(); |
1705 } | 1705 } |
1706 | 1706 |
1707 void registerReadTypeVariable(TypeVariableElement element) { | 1707 void registerReadTypeVariable(TypeVariableElement element) { |
1708 readTypeVariables.add(element); | 1708 readTypeVariables.add(element); |
1709 } | 1709 } |
1710 } | 1710 } |
OLD | NEW |