| 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 dart2js.io.location_provider; | 5 library dart2js.io.location_provider; |
| 6 | 6 |
| 7 import 'code_output.dart' show CodeOutputListener; | 7 import 'code_output.dart' show CodeOutputListener; |
| 8 | 8 |
| 9 import 'package:kernel/ast.dart' show Location, Source; | 9 import 'package:kernel/ast.dart' show Location, Source; |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 length += text.length; | 32 length += text.length; |
| 33 } | 33 } |
| 34 | 34 |
| 35 @override | 35 @override |
| 36 void onText(String text) { | 36 void onText(String text) { |
| 37 _collect(text); | 37 _collect(text); |
| 38 } | 38 } |
| 39 | 39 |
| 40 @override | 40 @override |
| 41 Location getLocation(int offset) { | 41 Location getLocation(int offset) { |
| 42 RangeError.checkValueInInterval(offset, 0, length, "offset", | 42 RangeError.checkValueInInterval(offset, 0, length, 'offset'); |
| 43 "The value of 'offset' ($offset) must be between 0 and $length."); | |
| 44 return new Source(lineStarts, null).getLocation(null, offset); | 43 return new Source(lineStarts, null).getLocation(null, offset); |
| 45 } | 44 } |
| 46 | 45 |
| 47 @override | 46 @override |
| 48 void onDone(int length) { | 47 void onDone(int length) { |
| 49 lineStarts.add(length + 1); | 48 lineStarts.add(length + 1); |
| 50 this.length = length; | 49 this.length = length; |
| 51 } | 50 } |
| 52 | 51 |
| 53 String toString() { | 52 String toString() { |
| 54 return 'lineStarts=$lineStarts,length=$length'; | 53 return 'lineStarts=$lineStarts,length=$length'; |
| 55 } | 54 } |
| 56 } | 55 } |
| OLD | NEW |