Skip to content

Add explicit types to for-in loops #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_runner/lib/src/generate/watch_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class WatchImpl implements BuildState {

Map<AssetId, ChangeType> _collectChanges(List<List<AssetChange>> changes) {
var changeMap = <AssetId, ChangeType>{};
for (var change in changes.expand((l) => l)) {
for (AssetChange change in changes.expand((l) => l)) {
var originalChangeType = changeMap[change.id];
if (originalChangeType != null) {
switch (originalChangeType) {
Expand Down
2 changes: 1 addition & 1 deletion build_runner/test/common/test_phases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void checkBuild(BuildResult result,

final unhiddenOutputs = <String, dynamic>{};
final unhiddenAssets = new Set<AssetId>();
for (final id in outputs?.keys ?? const []) {
for (final String id in outputs?.keys ?? const []) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we should try to get more consistent about final vs not in for loops... :)

not a blocker anything as its a preexisting issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I know that the larger community pushed back against "final everywhere" but I find that I occasionally slip back into that habit...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya honestly I don't care, I can see it either way, but I do care that it is consistent :)

if (id.startsWith(r'$$')) {
final unhidden = id.substring(2);
unhiddenAssets.add(makeAssetId(unhidden));
Expand Down
2 changes: 1 addition & 1 deletion build_runner/test/generate/build_definition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ main() {
environment.reader);
var generatedACopyId = makeAssetId('a|lib/a.txt.copy');
var generatedACloneId = makeAssetId('a|lib/a.txt.clone');
for (var id in [generatedACopyId, generatedACloneId]) {
for (AssetId id in [generatedACopyId, generatedACloneId]) {
var node = originalAssetGraph.get(id) as GeneratedAssetNode;
node.wasOutput = true;
node.needsUpdate = false;
Expand Down