Skip to content

Commit a2fb5b1

Browse files
committed
formatting
1 parent 70d92dc commit a2fb5b1

File tree

1 file changed

+52
-55
lines changed

1 file changed

+52
-55
lines changed

lib/src/diff.dart

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ CandidateThing longest_common_subsequence(List<String> file1, List<String>
133133
Map<int, CandidateThing> candidates = new Map<int, CandidateThing>();
134134

135135
candidates[0] = new CandidateThing()
136-
..file1index = -1
137-
..file2index = -1
138-
..chain = null;
136+
..file1index = -1
137+
..file2index = -1
138+
..chain = null;
139139

140140
for (int j = 0; j < file2.length; j++) {
141141
String line = file2[j];
@@ -162,18 +162,17 @@ CandidateThing longest_common_subsequence(List<String> file1, List<String>
162162
int j = file2indices[jX];
163163

164164
for (s = r; s < candidates.length; s++) {
165-
if ((candidates[s].file2index < j) &&
166-
((s == candidates.length - 1) ||
167-
(candidates[s + 1].file2index > j))) {
165+
if ((candidates[s].file2index < j) && ((s == candidates.length - 1) ||
166+
(candidates[s + 1].file2index > j))) {
168167
break;
169168
}
170169
}
171170

172171
if (s < candidates.length) {
173172
CandidateThing newCandidate = new CandidateThing()
174-
..file1index = i
175-
..file2index = j
176-
..chain = candidates[s];
173+
..file1index = i
174+
..file2index = j
175+
..chain = candidates[s];
177176

178177
candidates[r] = c;
179178
r = s + 1;
@@ -208,24 +207,22 @@ List<commonOrDifferentThing> diff_comm(List<String> file1, List<String> file2) {
208207
int tail1 = file1.length;
209208
int tail2 = file2.length;
210209

211-
commonOrDifferentThing common = new commonOrDifferentThing()
212-
..common = new List<String>();
210+
commonOrDifferentThing common = new commonOrDifferentThing()..common =
211+
new List<String>();
213212

214213
void processCommon() {
215214
if (common.common.length > 0) {
216215
common.common = common.common.reversed.toList();
217216
result.add(common);
218-
common = new commonOrDifferentThing()
219-
..common = new List<String>();
217+
common = new commonOrDifferentThing()..common = new List<String>();
220218
}
221219
}
222220

223221
for (CandidateThing candidate = longest_common_subsequence(file1, file2);
224-
candidate != null;
225-
candidate = candidate.chain) {
222+
candidate != null; candidate = candidate.chain) {
226223
commonOrDifferentThing different = new commonOrDifferentThing()
227-
..file1 = new List<String>()
228-
..file2 = new List<String>();
224+
..file1 = new List<String>()
225+
..file2 = new List<String>();
229226

230227
while (--tail1 > candidate.file1index) {
231228
different.file1.add(file1[tail1]);
@@ -261,8 +258,7 @@ List<patchResult> diff_patch(List<String> file1, List<String> file2) {
261258
int tail2 = file2.length;
262259

263260
for (CandidateThing candidate = longest_common_subsequence(file1, file2);
264-
candidate != null;
265-
candidate = candidate.chain) {
261+
candidate != null; candidate = candidate.chain) {
266262
int mismatchLength1 = tail1 - candidate.file1index - 1;
267263
int mismatchLength2 = tail2 - candidate.file2index - 1;
268264
tail1 = candidate.file1index;
@@ -271,8 +267,10 @@ List<patchResult> diff_patch(List<String> file1, List<String> file2) {
271267
if (mismatchLength1 > 0 || mismatchLength2 > 0) {
272268
patchResult thisResult = new patchResult();
273269
thisResult
274-
..file1 = new patchDescriptionThing.fromFile(file1, candidate.file1index + 1, mismatchLength1)
275-
..file2 = new patchDescriptionThing.fromFile(file2, candidate.file2index + 1, mismatchLength2);
270+
..file1 = new patchDescriptionThing.fromFile(file1,
271+
candidate.file1index + 1, mismatchLength1)
272+
..file2 = new patchDescriptionThing.fromFile(file2,
273+
candidate.file2index + 1, mismatchLength2);
276274

277275
result.add(thisResult);
278276
}
@@ -313,8 +311,7 @@ List<diffSet> diff_indices(List<String> file1, List<String> file2) {
313311
int tail2 = file2.length;
314312

315313
for (CandidateThing candidate = longest_common_subsequence(file1, file2);
316-
candidate != null;
317-
candidate = candidate.chain) {
314+
candidate != null; candidate = candidate.chain) {
318315
int mismatchLength1 = tail1 - candidate.file1index - 1;
319316
int mismatchLength2 = tail2 - candidate.file2index - 1;
320317
tail1 = candidate.file1index;
@@ -323,12 +320,12 @@ List<diffSet> diff_indices(List<String> file1, List<String> file2) {
323320
if (mismatchLength1 > 0 || mismatchLength2 > 0) {
324321
diffSet diffSetResult = new diffSet();
325322
diffSetResult
326-
..file1 = (new chunkReference()
327-
..offset = tail1 + 1
328-
..length = mismatchLength1)
329-
..file2 = (new chunkReference()
330-
..offset = tail2 + 1
331-
..length = mismatchLength2);
323+
..file1 = (new chunkReference()
324+
..offset = tail1 + 1
325+
..length = mismatchLength1)
326+
..file2 = (new chunkReference()
327+
..offset = tail2 + 1
328+
..length = mismatchLength2);
332329
result.add(diffSetResult);
333330
}
334331
}
@@ -340,11 +337,11 @@ List<diffSet> diff_indices(List<String> file1, List<String> file2) {
340337
void addHunk(diffSet h, Side side, List<diff3Set> hunks) {
341338
diff3Set diff3SetHunk = new diff3Set();
342339
diff3SetHunk
343-
..side = side
344-
..file1offset = h.file1.offset
345-
..file1length = h.file1.length
346-
..file2offset = h.file2.offset
347-
..file2length = h.file2.length;
340+
..side = side
341+
..file1offset = h.file1.offset
342+
..file1length = h.file1.length
343+
..file2offset = h.file2.offset
344+
..file2length = h.file2.length;
348345
hunks.add(diff3SetHunk);
349346
}
350347

@@ -389,9 +386,9 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
389386
if (targetOffset > commonOffset) {
390387
patch3Set patch3SetResult = new patch3Set();
391388
patch3SetResult
392-
..side = Side.Old
393-
..offset = commonOffset
394-
..length = targetOffset - commonOffset;
389+
..side = Side.Old
390+
..offset = commonOffset
391+
..length = targetOffset - commonOffset;
395392
result.add(patch3SetResult);
396393
}
397394
}
@@ -421,9 +418,9 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
421418
if (hunk.file2length > 0) {
422419
patch3Set patch3SetResult = new patch3Set();
423420
patch3SetResult
424-
..side = hunk.side
425-
..offset = hunk.file2offset
426-
..length = hunk.file2length;
421+
..side = hunk.side
422+
..offset = hunk.file2offset
423+
..length = hunk.file2length;
427424
result.add(patch3SetResult);
428425
}
429426
} else {
@@ -460,24 +457,24 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
460457
r.file2RegionEnd = Math.max(oRhs, r.file2RegionEnd);
461458
}
462459

463-
int aLhs = regions[Side.Left].file1RegionStart +
464-
(regionLhs - regions[Side.Left].file2RegionStart);
465-
int aRhs = regions[Side.Left].file1RegionEnd +
466-
(regionRhs - regions[Side.Left].file2RegionEnd);
467-
int bLhs = regions[Side.Right].file1RegionStart +
468-
(regionLhs - regions[Side.Right].file2RegionStart);
469-
int bRhs = regions[Side.Right].file1RegionEnd +
470-
(regionRhs - regions[Side.Right].file2RegionEnd);
460+
int aLhs = regions[Side.Left].file1RegionStart + (regionLhs -
461+
regions[Side.Left].file2RegionStart);
462+
int aRhs = regions[Side.Left].file1RegionEnd + (regionRhs -
463+
regions[Side.Left].file2RegionEnd);
464+
int bLhs = regions[Side.Right].file1RegionStart + (regionLhs -
465+
regions[Side.Right].file2RegionStart);
466+
int bRhs = regions[Side.Right].file1RegionEnd + (regionRhs -
467+
regions[Side.Right].file2RegionEnd);
471468

472469
patch3Set patch3SetResult = new patch3Set();
473470
patch3SetResult
474-
..side = Side.Conflict
475-
..offset = aLhs
476-
..length = aRhs - aLhs
477-
..conflictOldOffset = regionLhs
478-
..conflictOldLength = regionRhs - regionLhs
479-
..conflictRightOffset = bLhs
480-
..conflictRightLength = bRhs - bLhs;
471+
..side = Side.Conflict
472+
..offset = aLhs
473+
..length = aRhs - aLhs
474+
..conflictOldOffset = regionLhs
475+
..conflictOldLength = regionRhs - regionLhs
476+
..conflictRightOffset = bLhs
477+
..conflictRightLength = bRhs - bLhs;
481478
result.add(patch3SetResult);
482479
}
483480

0 commit comments

Comments
 (0)