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