File tree Expand file tree Collapse file tree 4 files changed +2125
-5150
lines changed Expand file tree Collapse file tree 4 files changed +2125
-5150
lines changed Original file line number Diff line number Diff line change @@ -1401,7 +1401,7 @@ class DiffMatchPatch {
14011401 param = param.replaceAll ('+' , '%2B' );
14021402 try {
14031403 param = Uri .decodeFull (param);
1404- } on ArgumentError catch (e) {
1404+ } on ArgumentError {
14051405 // Malformed URI sequence.
14061406 throw new ArgumentError ('Illegal escape in diff_fromDelta: $param ' );
14071407 }
@@ -1413,7 +1413,7 @@ class DiffMatchPatch {
14131413 int n;
14141414 try {
14151415 n = int .parse (param);
1416- } on FormatException catch (e) {
1416+ } on FormatException {
14171417 throw new ArgumentError ('Invalid number in diff_fromDelta: $param ' );
14181418 }
14191419 if (n < 0 ) {
@@ -1423,7 +1423,7 @@ class DiffMatchPatch {
14231423 String text;
14241424 try {
14251425 text = text1.substring (pointer, pointer += n);
1426- } on RangeError catch (e) {
1426+ } on RangeError {
14271427 throw new ArgumentError ('Delta length ($pointer )'
14281428 ' larger than source text length (${text1 .length }).' );
14291429 }
@@ -2163,7 +2163,7 @@ class DiffMatchPatch {
21632163 String line;
21642164 try {
21652165 line = Uri .decodeFull (text[textPointer].substring (1 ));
2166- } on ArgumentError catch (e) {
2166+ } on ArgumentError {
21672167 // Malformed URI sequence.
21682168 throw new ArgumentError ('Illegal escape in patch_fromText: $line ' );
21692169 }
Original file line number Diff line number Diff line change @@ -52,6 +52,19 @@ class Diff {
5252 * [other] is another Diff to compare against.
5353 * Returns true or false.
5454 */
55- bool operator == (Diff other) =>
56- operation == other.operation && text == other.text;
55+ @override
56+ bool operator == (Object other) =>
57+ identical (this , other) ||
58+ other is Diff &&
59+ runtimeType == other.runtimeType &&
60+ operation == other.operation &&
61+ text == other.text;
62+
63+ /**
64+ * Generate a uniquely identifiable hashcode for this Diff.
65+ * Returns numeric hashcode.
66+ */
67+ @override
68+ int get hashCode =>
69+ operation.hashCode ^ text.hashCode;
5770}
Original file line number Diff line number Diff line change 1616 * limitations under the License.
1717 */
1818
19- // Can't import DiffMatchPatch library since the private functions would be
20- // unavailable. Instead, import all the source files.
21- import 'dart:collection' ;
22- import 'dart:math' ;
2319import '../DiffMatchPatch.dart' ;
2420
2521// Expect class disappeared from Dart unexpectedly. Here's a minimal shim.
@@ -43,7 +39,7 @@ class Expect {
4339 static void throws (void f (), String msg) {
4440 try {
4541 f ();
46- } catch (e, s ) {
42+ } catch (e) {
4743 return ;
4844 }
4945 throw new Exception ('Expect.throws($msg ) fails' );
You can’t perform that action at this time.
0 commit comments