| OLD | NEW |
| 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('mirrors.util'); | 5 #library('mirrors.util'); |
| 6 | 6 |
| 7 // TODO(rnystrom): Use "package:" URL (#4968). | 7 // TODO(rnystrom): Use "package:" URL (#4968). |
| 8 #import('mirrors.dart'); | 8 #import('mirrors.dart'); |
| 9 #import('../../../lib/compiler/implementation/util/characters.dart'); | 9 #import('../../../lib/compiler/implementation/util/characters.dart'); |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } else if (owner is TypeMirror) { | 51 } else if (owner is TypeMirror) { |
| 52 return owner.library; | 52 return owner.library; |
| 53 } | 53 } |
| 54 throw new Exception('Unexpected owner: ${owner}'); | 54 throw new Exception('Unexpected owner: ${owner}'); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Returns the column of the start of a location. | 59 * Returns the column of the start of a location. |
| 60 */ | 60 */ |
| 61 int getLocationColumn(Location location) { | 61 int getLocationColumn(SourceLocation location) { |
| 62 String text = location.source.text; | 62 String text = location.source.text; |
| 63 int index = location.start-1; | 63 int index = location.start-1; |
| 64 var column = 0; | 64 var column = 0; |
| 65 while (0 <= index && index < text.length) { | 65 while (0 <= index && index < text.length) { |
| 66 var charCode = text.charCodeAt(index); | 66 var charCode = text.charCodeAt(index); |
| 67 if (charCode == $CR || charCode == $LF) { | 67 if (charCode == $CR || charCode == $LF) { |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 index--; | 70 index--; |
| 71 column++; | 71 column++; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 type = object; | 126 type = object; |
| 127 object = null; | 127 object = null; |
| 128 return type; | 128 return type; |
| 129 } else { | 129 } else { |
| 130 return push(queue.removeFirst()); | 130 return push(queue.removeFirst()); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool get hasNext => !queue.isEmpty || object !== null; | 134 bool get hasNext => !queue.isEmpty || object !== null; |
| 135 } | 135 } |
| OLD | NEW |