| 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 * [StringBase] contains common methods used by concrete String implementations, | 6 * [StringBase] contains common methods used by concrete String implementations, |
| 7 * e.g., OneByteString. | 7 * e.g., OneByteString. |
| 8 */ | 8 */ |
| 9 class StringBase { | 9 class StringBase { |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 String concat(String other) native "String_concat"; | 49 String concat(String other) native "String_concat"; |
| 50 | 50 |
| 51 String toString() { | 51 String toString() { |
| 52 return this; | 52 return this; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool operator ==(Object other) { | 55 bool operator ==(Object other) { |
| 56 if (this === other) { | 56 if (this === other) { |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 if (!(other is String) || | 59 if ((other is !String) || |
| 60 (this.length != other.length)) { | 60 (this.length != other.length)) { |
| 61 // TODO(5413632): Compare hash codes when both are present. | 61 // TODO(5413632): Compare hash codes when both are present. |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 return this.compareTo(other) === 0; | 64 return this.compareTo(other) === 0; |
| 65 } | 65 } |
| 66 | 66 |
| 67 int compareTo(String other) { | 67 int compareTo(String other) { |
| 68 int thisLength = this.length; | 68 int thisLength = this.length; |
| 69 int otherLength = other.length; | 69 int otherLength = other.length; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 for (int g in groups) { | 514 for (int g in groups) { |
| 515 result.add(group(g)); | 515 result.add(group(g)); |
| 516 } | 516 } |
| 517 return result; | 517 return result; |
| 518 } | 518 } |
| 519 | 519 |
| 520 final int _start; | 520 final int _start; |
| 521 final String str; | 521 final String str; |
| 522 final String pattern; | 522 final String pattern; |
| 523 } | 523 } |
| OLD | NEW |