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

Side by Side Diff: pkg/compiler/lib/src/source_file.dart

Issue 812233004: Add CodeOutput to prepare for emission without in-memory buffers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
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'; 7 import 'dart:math';
8 import 'dart:convert' show UTF8; 8 import 'dart:convert' show UTF8;
9 9
10 /// Interface for providing line/column information.
11 abstract class LineColumnProvider {
12 /// Returns the line number (0-based) for [offset].
13 int getLine(int offset);
14
15 /// Returns the column number (0-based) for [offset] at the given [line].
16 int getColumn(int line, int offset);
17 }
18
10 /** 19 /**
11 * Represents a file of source code. The content can be either a [String] or 20 * Represents a file of source code. The content can be either a [String] or
12 * a UTF-8 encoded [List<int>] of bytes. 21 * a UTF-8 encoded [List<int>] of bytes.
13 */ 22 */
14 abstract class SourceFile { 23 abstract class SourceFile implements LineColumnProvider {
15 24
16 /** The name of the file. */ 25 /** The name of the file. */
17 String get filename; 26 String get filename;
18 27
19 /** The text content of the file represented as a String. */ 28 /** The text content of the file represented as a String. */
20 String slowText(); 29 String slowText();
21 30
22 /** The content of the file represented as a UTF-8 encoded [List<int>]. */ 31 /** The content of the file represented as a UTF-8 encoded [List<int>]. */
23 List<int> slowUtf8Bytes(); 32 List<int> slowUtf8Bytes();
24 33
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 222
214 int get length => text.length; 223 int get length => text.length;
215 set length(int v) { } 224 set length(int v) { }
216 225
217 String slowText() => text; 226 String slowText() => text;
218 227
219 List<int> slowUtf8Bytes() => UTF8.encode(text); 228 List<int> slowUtf8Bytes() => UTF8.encode(text);
220 229
221 String slowSubstring(int start, int end) => text.substring(start, end); 230 String slowSubstring(int start, int end) => text.substring(start, end);
222 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698