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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/code_buffer.dart

Issue 11795002: Revert "Retry "Emit more stuff via ASTs"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart2js; 5 part of dart2js;
6 6
7 class CodeBuffer implements StringBuffer { 7 class CodeBuffer implements StringBuffer {
8 StringBuffer buffer; 8 StringBuffer buffer;
9 List<CodeBufferMarker> markers; 9 List<CodeBufferMarker> markers;
10 int lastBufferOffset = 0; 10 int lastBufferOffset = 0;
(...skipping 27 matching lines...) Expand all
38 CodeBufferMarker firstMarker = other.markers[0]; 38 CodeBufferMarker firstMarker = other.markers[0];
39 int offsetDelta = 39 int offsetDelta =
40 buffer.length + firstMarker.offsetDelta - lastBufferOffset; 40 buffer.length + firstMarker.offsetDelta - lastBufferOffset;
41 markers.add(new CodeBufferMarker(offsetDelta, 41 markers.add(new CodeBufferMarker(offsetDelta,
42 firstMarker.sourcePosition)); 42 firstMarker.sourcePosition));
43 for (int i = 1; i < other.markers.length; ++i) { 43 for (int i = 1; i < other.markers.length; ++i) {
44 markers.add(other.markers[i]); 44 markers.add(other.markers[i]);
45 } 45 }
46 lastBufferOffset = buffer.length + other.lastBufferOffset; 46 lastBufferOffset = buffer.length + other.lastBufferOffset;
47 } 47 }
48 buffer.add(other.getText()); 48 buffer.add(other.toString());
49 } 49 }
50 50
51 CodeBuffer addAll(Collection<Object> objects) { 51 CodeBuffer addAll(Collection<Object> objects) {
52 for (Object obj in objects) { 52 for (Object obj in objects) {
53 add(obj); 53 add(obj);
54 } 54 }
55 return this; 55 return this;
56 } 56 }
57 57
58 CodeBuffer addCharCode(int charCode) { 58 CodeBuffer addCharCode(int charCode) {
59 return add(new String.fromCharCodes([charCode])); 59 return add(new String.fromCharCodes([charCode]));
60 } 60 }
61 61
62 CodeBuffer clear() { 62 CodeBuffer clear() {
63 buffer.clear(); 63 buffer.clear();
64 markers.clear(); 64 markers.clear();
65 lastBufferOffset = 0; 65 lastBufferOffset = 0;
66 return this; 66 return this;
67 } 67 }
68 68
69 String toString() { 69 String toString() {
70 throw "Don't use CodeBuffer.toString() since it drops sourcemap data.";
71 }
72
73 String getText() {
74 return buffer.toString(); 70 return buffer.toString();
75 } 71 }
76 72
77 void beginMappedRange() { 73 void beginMappedRange() {
78 ++mappedRangeCounter; 74 ++mappedRangeCounter;
79 } 75 }
80 76
81 void endMappedRange() { 77 void endMappedRange() {
82 assert(mappedRangeCounter > 0); 78 assert(mappedRangeCounter > 0);
83 --mappedRangeCounter; 79 --mappedRangeCounter;
(...skipping 13 matching lines...) Expand all
97 }); 93 });
98 } 94 }
99 } 95 }
100 96
101 class CodeBufferMarker { 97 class CodeBufferMarker {
102 final int offsetDelta; 98 final int offsetDelta;
103 final sourcePosition; 99 final sourcePosition;
104 100
105 CodeBufferMarker(this.offsetDelta, this.sourcePosition); 101 CodeBufferMarker(this.offsetDelta, this.sourcePosition);
106 } 102 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698