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

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

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. 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
« no previous file with comments | « lib/compiler/implementation/lib/io.dart ('k') | lib/compiler/implementation/tree/nodes.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('dart:math');
8
7 #import('colors.dart', prefix: 'colors'); 9 #import('colors.dart', prefix: 'colors');
8 10
9 /** 11 /**
10 * Represents a file of source code. 12 * Represents a file of source code.
11 */ 13 */
12 class SourceFile { 14 class SourceFile {
13 15
14 /** The name of the file. */ 16 /** The name of the file. */
15 final String filename; 17 final String filename;
16 18
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (includeText) { 66 if (includeText) {
65 buf.add('\n'); 67 buf.add('\n');
66 var textLine; 68 var textLine;
67 // +1 for 0-indexing, +1 again to avoid the last line of the file 69 // +1 for 0-indexing, +1 again to avoid the last line of the file
68 if ((line + 2) < _lineStarts.length) { 70 if ((line + 2) < _lineStarts.length) {
69 textLine = text.substring(_lineStarts[line], _lineStarts[line+1]); 71 textLine = text.substring(_lineStarts[line], _lineStarts[line+1]);
70 } else { 72 } else {
71 textLine = '${text.substring(_lineStarts[line])}\n'; 73 textLine = '${text.substring(_lineStarts[line])}\n';
72 } 74 }
73 75
74 int toColumn = Math.min(column + (end-start), textLine.length); 76 int toColumn = min(column + (end-start), textLine.length);
75 buf.add(textLine.substring(0, column)); 77 buf.add(textLine.substring(0, column));
76 buf.add(color(textLine.substring(column, toColumn))); 78 buf.add(color(textLine.substring(column, toColumn)));
77 buf.add(textLine.substring(toColumn)); 79 buf.add(textLine.substring(toColumn));
78 80
79 int i = 0; 81 int i = 0;
80 for (; i < column; i++) { 82 for (; i < column; i++) {
81 buf.add(' '); 83 buf.add(' ');
82 } 84 }
83 85
84 for (; i < toColumn; i++) { 86 for (; i < toColumn; i++) {
85 buf.add(color('^')); 87 buf.add(color('^'));
86 } 88 }
87 } 89 }
88 90
89 return buf.toString(); 91 return buf.toString();
90 } 92 }
91 } 93 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/lib/io.dart ('k') | lib/compiler/implementation/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698