| 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_dart2js; | 5 library mirrors_dart2js; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection' show LinkedHashMap; | 8 import 'dart:collection' show LinkedHashMap; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 if (length == 0) return 0; | 681 if (length == 0) return 0; |
| 682 | 682 |
| 683 var sourceFile = _script.file as SourceFile; | 683 var sourceFile = _script.file as SourceFile; |
| 684 if (sourceFile != null) { | 684 if (sourceFile != null) { |
| 685 return sourceFile.getColumn(sourceFile.getLine(offset), offset) + 1; | 685 return sourceFile.getColumn(sourceFile.getLine(offset), offset) + 1; |
| 686 } | 686 } |
| 687 int index = offset - 1; | 687 int index = offset - 1; |
| 688 var columnNumber = 0; | 688 var columnNumber = 0; |
| 689 while (0 <= index && index < sourceText.length) { | 689 while (0 <= index && index < sourceText.length) { |
| 690 columnNumber++; | 690 columnNumber++; |
| 691 var charCode = sourceText.charCodeAt(index); | 691 var codeUnit = sourceText.codeUnitAt(index); |
| 692 if (charCode == $CR || charCode == $LF) { | 692 if (codeUnit == $CR || codeUnit == $LF) { |
| 693 break; | 693 break; |
| 694 } | 694 } |
| 695 index--; | 695 index--; |
| 696 } | 696 } |
| 697 return columnNumber; | 697 return columnNumber; |
| 698 } | 698 } |
| 699 | 699 |
| 700 int get column { | 700 int get column { |
| 701 if (_column == null) { | 701 if (_column == null) { |
| 702 _column = _computeColumn(); | 702 _column = _computeColumn(); |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 return new Future.immediate( | 1733 return new Future.immediate( |
| 1734 new Dart2JsStringConstantMirror.fromString(mirrors, text)); | 1734 new Dart2JsStringConstantMirror.fromString(mirrors, text)); |
| 1735 } else if (fieldName == 'trimmedText') { | 1735 } else if (fieldName == 'trimmedText') { |
| 1736 return new Future.immediate( | 1736 return new Future.immediate( |
| 1737 new Dart2JsStringConstantMirror.fromString(mirrors, trimmedText)); | 1737 new Dart2JsStringConstantMirror.fromString(mirrors, trimmedText)); |
| 1738 } | 1738 } |
| 1739 // TODO(johnniwinther): Which exception/error should be thrown here? | 1739 // TODO(johnniwinther): Which exception/error should be thrown here? |
| 1740 throw new UnsupportedError('InstanceMirror does not have a reflectee'); | 1740 throw new UnsupportedError('InstanceMirror does not have a reflectee'); |
| 1741 } | 1741 } |
| 1742 } | 1742 } |
| OLD | NEW |