| 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 /** | 5 /** |
| 6 * An abstract string representation. | 6 * An abstract string representation. |
| 7 */ | 7 */ |
| 8 class ByteString implements SourceString { | 8 class ByteString implements SourceString { |
| 9 final List<int> bytes; | 9 final List<int> bytes; |
| 10 final int offset; | 10 final int offset; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 int computeHashCode() { | 36 int computeHashCode() { |
| 37 int code = 1; | 37 int code = 1; |
| 38 int end = offset + length; | 38 int end = offset + length; |
| 39 for (int i = offset; i < end; i++) { | 39 for (int i = offset; i < end; i++) { |
| 40 code += 19 * code + bytes[i]; | 40 code += 19 * code + bytes[i]; |
| 41 } | 41 } |
| 42 return code; | 42 return code; |
| 43 } | 43 } |
| 44 | 44 |
| 45 int compareTo(SourceString other) => sourceStringCompare(this, other); |
| 46 |
| 45 printOn(StringBuffer sb) { | 47 printOn(StringBuffer sb) { |
| 46 sb.add(slowToString()); | 48 sb.add(slowToString()); |
| 47 } | 49 } |
| 48 | 50 |
| 49 bool isEmpty() => length == 0; | 51 bool isEmpty() => length == 0; |
| 50 bool isPrivate() => !isEmpty() && bytes[offset] === $_; | 52 bool isPrivate() => !isEmpty() && bytes[offset] === $_; |
| 51 | 53 |
| 52 String get stringValue() => null; | 54 String get stringValue() => null; |
| 53 } | 55 } |
| 54 | 56 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 * A ByteString-valued token. | 137 * A ByteString-valued token. |
| 136 */ | 138 */ |
| 137 class ByteStringToken extends Token { | 139 class ByteStringToken extends Token { |
| 138 final ByteString value; | 140 final ByteString value; |
| 139 | 141 |
| 140 ByteStringToken(PrecedenceInfo info, ByteString this.value, int charOffset) | 142 ByteStringToken(PrecedenceInfo info, ByteString this.value, int charOffset) |
| 141 : super(info, charOffset); | 143 : super(info, charOffset); |
| 142 | 144 |
| 143 String toString() => value.toString(); | 145 String toString() => value.toString(); |
| 144 } | 146 } |
| OLD | NEW |