OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Helper for creating HTML visualization of the source map information | 5 /// Helper for creating HTML visualization of the source map information |
6 /// generated by a [SourceMapProcessor]. | 6 /// generated by a [SourceMapProcessor]. |
7 | 7 |
8 library sourcemap.html.helper; | 8 library sourcemap.html.helper; |
9 | 9 |
10 import 'dart:convert'; | 10 import 'dart:convert'; |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 $jsTrace | 420 $jsTrace |
421 </div> | 421 </div> |
422 '''); | 422 '''); |
423 } | 423 } |
424 return jsTraceBuffer.toString(); | 424 return jsTraceBuffer.toString(); |
425 } | 425 } |
426 | 426 |
427 /// Computes the HTML information for the [info]. | 427 /// Computes the HTML information for the [info]. |
428 SourceMapHtmlInfo createHtmlInfo( | 428 SourceMapHtmlInfo createHtmlInfo( |
429 SourceLocationCollection collection, SourceMapInfo info) { | 429 SourceLocationCollection collection, SourceMapInfo info) { |
430 js.Node node = info.node; | |
431 String code = info.code; | |
432 String name = info.name; | 430 String name = info.name; |
433 SourceLocationCollection subcollection = | 431 SourceLocationCollection subcollection = |
434 new SourceLocationCollection(collection); | 432 new SourceLocationCollection(collection); |
435 CodeProcessor codeProcessor = new CodeProcessor(name, subcollection); | 433 CodeProcessor codeProcessor = new CodeProcessor(name, subcollection); |
436 for (js.Node node in info.nodeMap.nodes) { | 434 for (js.Node node in info.nodeMap.nodes) { |
437 info.nodeMap[node] | 435 info.nodeMap[node] |
438 .forEach((int targetOffset, List<SourceLocation> sourceLocations) { | 436 .forEach((int targetOffset, List<SourceLocation> sourceLocations) { |
439 for (SourceLocation sourceLocation in sourceLocations) { | 437 for (SourceLocation sourceLocation in sourceLocations) { |
440 codeProcessor.addSourceLocation(targetOffset, sourceLocation); | 438 codeProcessor.addSourceLocation(targetOffset, sourceLocation); |
441 } | 439 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 String dartCode = truncate(codePoint.dartCode, 50); | 618 String dartCode = truncate(codePoint.dartCode, 50); |
621 buffer.write('<td class="code">${dartCode}</td>'); | 619 buffer.write('<td class="code">${dartCode}</td>'); |
622 buffer.write('<td>${escape(codePoint.sourceLocation.shortText)}</td>'); | 620 buffer.write('<td>${escape(codePoint.sourceLocation.shortText)}</td>'); |
623 } | 621 } |
624 buffer.write('</tr>'); | 622 buffer.write('</tr>'); |
625 }); | 623 }); |
626 buffer.write('</table>'); | 624 buffer.write('</table>'); |
627 | 625 |
628 return buffer.toString(); | 626 return buffer.toString(); |
629 } | 627 } |
OLD | NEW |