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

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

Issue 10689038: Revert "First step towards having patch files for generic libraries." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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.
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 return _lineStarts; 36 return _lineStarts;
37 } 37 }
38 38
39 int getLine(int position) { 39 int getLine(int position) {
40 // TODO(jimhug): Implement as binary search. 40 // TODO(jimhug): Implement as binary search.
41 var starts = lineStarts; 41 var starts = lineStarts;
42 for (int i=0; i < starts.length; i++) { 42 for (int i=0; i < starts.length; i++) {
43 if (starts[i] > position) return i-1; 43 if (starts[i] > position) return i-1;
44 } 44 }
45 throw 'bad position #$position in file $filename with ' 45 throw 'bad position';
46 'length ${text.length}.';
47 } 46 }
48 47
49 int getColumn(int line, int position) { 48 int getColumn(int line, int position) {
50 return position - lineStarts[line]; 49 return position - lineStarts[line];
51 } 50 }
52 51
53 /** 52 /**
54 * Create a pretty string representation from a character position 53 * Create a pretty string representation from a character position
55 * in the file. 54 * in the file.
56 */ 55 */
(...skipping 25 matching lines...) Expand all
82 } 81 }
83 82
84 for (; i < toColumn; i++) { 83 for (; i < toColumn; i++) {
85 buf.add(color('^')); 84 buf.add(color('^'));
86 } 85 }
87 } 86 }
88 87
89 return buf.toString(); 88 return buf.toString();
90 } 89 }
91 } 90 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/scanner_task.dart ('k') | lib/compiler/implementation/source_map_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698