| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // TODO(jimhug): This should be an interface to work better with tools. | 5 // TODO(jimhug): This should be an interface to work better with tools. |
| 6 /** | 6 /** |
| 7 * Represents a file of source code. | 7 * Represents a file of source code. |
| 8 */ | 8 */ |
| 9 class SourceFile implements Comparable { | 9 class SourceFile implements Comparable { |
| 10 // TODO(terry): This filename for in memory buffer. May need to rework if |
| 11 // filename is used for more than informational. |
| 12 static String IN_MEMORY_FILE = '<buffer>'; |
| 13 |
| 10 /** The name of the file. */ | 14 /** The name of the file. */ |
| 11 final String filename; | 15 final String filename; |
| 12 | 16 |
| 13 /** The text content of the file. */ | 17 /** The text content of the file. */ |
| 14 String _text; | 18 String _text; |
| 15 | 19 |
| 16 /** | 20 /** |
| 17 * The order of the source file in a given library. This is used while we're | 21 * The order of the source file in a given library. This is used while we're |
| 18 * writing code for a library. A single source file can be used | 22 * writing code for a library. A single source file can be used |
| 19 */ | 23 */ |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 149 |
| 146 /** Compares two source spans by file and position. Handles nulls. */ | 150 /** Compares two source spans by file and position. Handles nulls. */ |
| 147 int compareTo(SourceSpan other) { | 151 int compareTo(SourceSpan other) { |
| 148 if (file == other.file) { | 152 if (file == other.file) { |
| 149 int d = start - other.start; | 153 int d = start - other.start; |
| 150 return d == 0 ? (end - other.end) : d; | 154 return d == 0 ? (end - other.end) : d; |
| 151 } | 155 } |
| 152 return file.compareTo(other.file); | 156 return file.compareTo(other.file); |
| 153 } | 157 } |
| 154 } | 158 } |
| OLD | NEW |