| 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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 | 1541 |
| 1542 String buildSourceMap(CodeBuffer buffer, SourceFile compiledFile) { | 1542 String buildSourceMap(CodeBuffer buffer, SourceFile compiledFile) { |
| 1543 SourceMapBuilder sourceMapBuilder = | 1543 SourceMapBuilder sourceMapBuilder = |
| 1544 new SourceMapBuilder(compiler.sourceMapUri); | 1544 new SourceMapBuilder(compiler.sourceMapUri); |
| 1545 buffer.forEachSourceLocation(sourceMapBuilder.addMapping); | 1545 buffer.forEachSourceLocation(sourceMapBuilder.addMapping); |
| 1546 return sourceMapBuilder.build(compiledFile); | 1546 return sourceMapBuilder.build(compiledFile); |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 void outputSourceMap(String code, String name) { | 1549 void outputSourceMap(String code, String name) { |
| 1550 if (!generateSourceMap) return; | 1550 if (!generateSourceMap) return; |
| 1551 SourceFile compiledFile = new SourceFile(null, compiler.assembledCode); | 1551 // Create a source file for the compilation output. This allows using |
| 1552 // [:getLine:] to transform offsets to line numbers in [SourceMapBuilder]. |
| 1553 SourceFile compiledFile = |
| 1554 new StringSourceFile(null, compiler.assembledCode); |
| 1552 String sourceMap = buildSourceMap(mainBuffer, compiledFile); | 1555 String sourceMap = buildSourceMap(mainBuffer, compiledFile); |
| 1553 compiler.outputProvider(name, 'js.map') | 1556 compiler.outputProvider(name, 'js.map') |
| 1554 ..add(sourceMap) | 1557 ..add(sourceMap) |
| 1555 ..close(); | 1558 ..close(); |
| 1556 } | 1559 } |
| 1557 | 1560 |
| 1558 bool isDeferred(Element element) { | 1561 bool isDeferred(Element element) { |
| 1559 return compiler.deferredLoadTask.isDeferred(element); | 1562 return compiler.deferredLoadTask.isDeferred(element); |
| 1560 } | 1563 } |
| 1561 | 1564 |
| 1562 bool get areAnyElementsDeferred { | 1565 bool get areAnyElementsDeferred { |
| 1563 return compiler.deferredLoadTask.areAnyElementsDeferred; | 1566 return compiler.deferredLoadTask.areAnyElementsDeferred; |
| 1564 } | 1567 } |
| 1565 } | 1568 } |
| OLD | NEW |