Chromium Code Reviews| Index: lib/compiler/implementation/source_file.dart |
| diff --git a/lib/compiler/implementation/source_file.dart b/lib/compiler/implementation/source_file.dart |
| index d517e76eb22146f4e81039495b7ef84cc88c7edb..9ba3b2bc810d53a6b5df3e635ed2244c813f94e1 100644 |
| --- a/lib/compiler/implementation/source_file.dart |
| +++ b/lib/compiler/implementation/source_file.dart |
| @@ -26,11 +26,8 @@ class SourceFile { |
| List<int> get lineStarts { |
| if (_lineStarts == null) { |
| var starts = [0]; |
| - var index = 0; |
| - while (index < text.length) { |
| - index = text.indexOf('\n', index) + 1; |
| - if (index <= 0) break; |
| - starts.add(index); |
| + for (Match match in const RegExp("\r\n?|\n\r?").allMatches(text)) { |
| + starts.add(match.start + 1); |
|
ahe
2012/11/01 13:05:22
What is the performance overhead of this? Perhaps
Johnni Winther
2012/11/01 15:27:13
Enormous. I'll revert.
|
| } |
| starts.add(text.length + 1); |
| _lineStarts = starts; |