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

Side by Side Diff: dart/lib/compiler/implementation/source_file.dart

Issue 10407064: Purge String operator+ from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comment Created 8 years, 7 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 | « dart/lib/compiler/implementation/dart2js.dart ('k') | dart/utils/compiler/build_helper.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 #library('source_file'); 5 #library('source_file');
6 6
7 #import('colors.dart', prefix: 'colors'); 7 #import('colors.dart', prefix: 'colors');
8 8
9 /** 9 /**
10 * Represents a file of source code. 10 * Represents a file of source code.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 var buf = new StringBuffer( 61 var buf = new StringBuffer(
62 '${filename}:${line + 1}:${column + 1}: $message'); 62 '${filename}:${line + 1}:${column + 1}: $message');
63 if (includeText) { 63 if (includeText) {
64 buf.add('\n'); 64 buf.add('\n');
65 var textLine; 65 var textLine;
66 // +1 for 0-indexing, +1 again to avoid the last line of the file 66 // +1 for 0-indexing, +1 again to avoid the last line of the file
67 if ((line + 2) < _lineStarts.length) { 67 if ((line + 2) < _lineStarts.length) {
68 textLine = text.substring(_lineStarts[line], _lineStarts[line+1]); 68 textLine = text.substring(_lineStarts[line], _lineStarts[line+1]);
69 } else { 69 } else {
70 textLine = text.substring(_lineStarts[line]) + '\n'; 70 textLine = '${text.substring(_lineStarts[line])}\n';
71 } 71 }
72 72
73 int toColumn = Math.min(column + (end-start), textLine.length); 73 int toColumn = Math.min(column + (end-start), textLine.length);
74 if (colors.enabled) { 74 if (colors.enabled) {
75 buf.add(textLine.substring(0, column)); 75 buf.add(textLine.substring(0, column));
76 buf.add(colors.RED_COLOR); 76 buf.add(colors.RED_COLOR);
77 buf.add(textLine.substring(column, toColumn)); 77 buf.add(textLine.substring(column, toColumn));
78 buf.add(colors.NO_COLOR); 78 buf.add(colors.NO_COLOR);
79 buf.add(textLine.substring(toColumn)); 79 buf.add(textLine.substring(toColumn));
80 } else { 80 } else {
81 buf.add(textLine); 81 buf.add(textLine);
82 } 82 }
83 83
84 int i = 0; 84 int i = 0;
85 for (; i < column; i++) { 85 for (; i < column; i++) {
86 buf.add(' '); 86 buf.add(' ');
87 } 87 }
88 88
89 if (colors.enabled) buf.add(colors.RED_COLOR); 89 if (colors.enabled) buf.add(colors.RED_COLOR);
90 for (; i < toColumn; i++) { 90 for (; i < toColumn; i++) {
91 buf.add('^'); 91 buf.add('^');
92 } 92 }
93 if (colors.enabled) buf.add(colors.NO_COLOR); 93 if (colors.enabled) buf.add(colors.NO_COLOR);
94 } 94 }
95 95
96 return buf.toString(); 96 return buf.toString();
97 } 97 }
98 } 98 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/dart2js.dart ('k') | dart/utils/compiler/build_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698