Skip to content

Commit 3f1d014

Browse files
knaeckeKamidavidmorgan
authored andcommitted
refactor(built_value_generator): use safer name for temporary hash code variable
1 parent 327c6aa commit 3f1d014

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

built_value_generator/lib/src/value_source_class.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,18 +1209,18 @@ abstract class ValueSourceClass
12091209
// Use a different seed for builders than for values, so they do not have
12101210
// identical hashCodes if the values are identical.
12111211
final seed = forBuilder ? 1 : 0;
1212-
result.writeln('int hash = $seed;');
1212+
result.writeln('int _\$hash = $seed;');
12131213

12141214
for (var field in comparedFields) {
1215-
result.writeln('hash = \$jc(hash, ${field.name}.hashCode);');
1215+
result.writeln('_\$hash = \$jc(_\$hash, ${field.name}.hashCode);');
12161216
}
12171217

1218-
result.writeln('hash = \$jf(hash);');
1218+
result.writeln('_\$hash = \$jf(_\$hash);');
12191219

12201220
if (generateMemoizedHashCode) {
1221-
result.writeln('return __hashCode ??= hash;');
1221+
result.writeln('return __hashCode ??= _\$hash;');
12221222
} else {
1223-
result.writeln('return hash;');
1223+
result.writeln('return _\$hash;');
12241224
}
12251225
}
12261226
result.writeln('}');

0 commit comments

Comments
 (0)