Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: lib/compiler/implementation/js/printer.dart

Issue 10911091: Add empty mapping entries for the ranges of generated JavaScript that don't map to any Dart source … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class Printer implements NodeVisitor { 5 class Printer implements NodeVisitor {
6 final bool shouldCompressOutput; 6 final bool shouldCompressOutput;
7 leg.Compiler compiler; 7 leg.Compiler compiler;
8 var positionElement; 8 var positionElement;
9 leg.CodeBuffer outBuffer; 9 leg.CodeBuffer outBuffer;
10 int indentLevel = 0; 10 int indentLevel = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 } 53 }
54 54
55 void recordSourcePosition(var position) { 55 void recordSourcePosition(var position) {
56 if (position != null) { 56 if (position != null) {
57 outBuffer.setSourceLocation(positionElement, position); 57 outBuffer.setSourceLocation(positionElement, position);
58 } 58 }
59 } 59 }
60 60
61 visit(Node node) { 61 visit(Node node) {
62 if (node.sourcePosition != null) {
floitsch 2012/09/05 14:22:18 one line.
podivilov 2012/09/06 10:52:25 Done.
63 outBuffer.beginMappedRange();
64 }
62 recordSourcePosition(node.sourcePosition); 65 recordSourcePosition(node.sourcePosition);
63 node.accept(this); 66 node.accept(this);
64 recordSourcePosition(node.endSourcePosition); 67 recordSourcePosition(node.endSourcePosition);
68 if (node.sourcePosition != null) {
floitsch 2012/09/05 14:22:18 one line.
podivilov 2012/09/06 10:52:25 Done.
69 outBuffer.endMappedRange();
70 }
65 } 71 }
66 72
67 visitCommaSeparated(List<Node> nodes, int hasRequiredType, 73 visitCommaSeparated(List<Node> nodes, int hasRequiredType,
68 [bool newInForInit, bool newAtStatementBegin]) { 74 [bool newInForInit, bool newAtStatementBegin]) {
69 for (int i = 0; i < nodes.length; i++) { 75 for (int i = 0; i < nodes.length; i++) {
70 if (i != 0) { 76 if (i != 0) {
71 atStatementBegin = false; 77 atStatementBegin = false;
72 out(","); 78 out(",");
73 spaceOut(); 79 spaceOut();
74 } 80 }
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 } 824 }
819 825
820 826
821 leg.CodeBuffer prettyPrint(Node node, 827 leg.CodeBuffer prettyPrint(Node node,
822 leg.Compiler compiler, 828 leg.Compiler compiler,
823 Dynamic positionElement) { 829 Dynamic positionElement) {
824 Printer printer = new Printer(compiler, positionElement); 830 Printer printer = new Printer(compiler, positionElement);
825 printer.visit(node); 831 printer.visit(node);
826 return printer.outBuffer; 832 return printer.outBuffer;
827 } 833 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698