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

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

Issue 10876008: Remove most superfluous getter arguments from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 #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.
11 */ 11 */
12 class SourceFile { 12 class SourceFile {
13 13
14 /** The name of the file. */ 14 /** The name of the file. */
15 final String filename; 15 final String filename;
16 16
17 /** The text content of the file. */ 17 /** The text content of the file. */
18 final String text; 18 final String text;
19 19
20 List<int> _lineStarts; 20 List<int> _lineStarts;
21 21
22 SourceFile(this.filename, this.text); 22 SourceFile(this.filename, this.text);
23 23
24 List<int> get lineStarts() { 24 List<int> get lineStarts {
25 if (_lineStarts == null) { 25 if (_lineStarts == null) {
26 var starts = [0]; 26 var starts = [0];
27 var index = 0; 27 var index = 0;
28 while (index < text.length) { 28 while (index < text.length) {
29 index = text.indexOf('\n', index) + 1; 29 index = text.indexOf('\n', index) + 1;
30 if (index <= 0) break; 30 if (index <= 0) break;
31 starts.add(index); 31 starts.add(index);
32 } 32 }
33 starts.add(text.length + 1); 33 starts.add(text.length + 1);
34 _lineStarts = starts; 34 _lineStarts = starts;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 for (; i < toColumn; i++) { 84 for (; i < toColumn; i++) {
85 buf.add(color('^')); 85 buf.add(color('^'));
86 } 86 }
87 } 87 }
88 88
89 return buf.toString(); 89 return buf.toString();
90 } 90 }
91 } 91 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/script.dart ('k') | dart/lib/compiler/implementation/ssa/bailout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698