refactor: change naming of local variable to reflect intent

This commit is contained in:
Aleksey Kulikov 2021-09-30 19:10:43 +03:00
parent 5f7fdf4bd3
commit 9686d93935
3 changed files with 13 additions and 13 deletions

View file

@ -337,9 +337,9 @@ class DiffLine {
GitDiffLine get origin {
final originInt = _diffLinePointer.ref.origin;
late final GitDiffLine result;
for (var flag in GitDiffLine.values) {
if (originInt == flag.value) {
result = flag;
for (var type in GitDiffLine.values) {
if (originInt == type.value) {
result = type;
}
}
return result;

View file

@ -7,9 +7,9 @@ class Features {
var result = <GitFeature>[];
final featuresInt = libgit2.git_libgit2_features();
for (var flag in GitFeature.values) {
if (featuresInt & flag.value == flag.value) {
result.add(flag);
for (var feature in GitFeature.values) {
if (featuresInt & feature.value == feature.value) {
result.add(feature);
}
}

View file

@ -274,7 +274,7 @@ class Repository {
GitRepositoryState get state {
final stateInt = bindings.state(_repoPointer);
return GitRepositoryState.values
.singleWhere((flag) => stateInt == flag.value);
.singleWhere((state) => stateInt == state.value);
}
/// Removes all the metadata associated with an ongoing command like
@ -560,9 +560,9 @@ class Repository {
var statuses = <GitStatus>{};
// Skipping GitStatus.current because entry that is in the list can't be without changes
// but `&` on `0` value falsly adds it to the set of flags
for (var flag in GitStatus.values.skip(1)) {
if (entry.ref.status & flag.value == flag.value) {
statuses.add(flag);
for (var status in GitStatus.values.skip(1)) {
if (entry.ref.status & status.value == status.value) {
statuses.add(status);
}
}
result[path] = statuses;
@ -592,9 +592,9 @@ class Repository {
statuses.add(GitStatus.current);
} else {
// Skipping GitStatus.current because `&` on `0` value falsly adds it to the set of flags
for (var flag in GitStatus.values.skip(1)) {
if (statusInt & flag.value == flag.value) {
statuses.add(flag);
for (var status in GitStatus.values.skip(1)) {
if (statusInt & status.value == status.value) {
statuses.add(status);
}
}
}