Skip to content

Commit

Permalink
Support var in enhanced for loops
Browse files Browse the repository at this point in the history
Fixes #463

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=308891540
  • Loading branch information
cushon authored and cpovirk committed Apr 29, 2020
1 parent ca529a2 commit e19b763
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2561,13 +2561,21 @@ private void visitToDeclare(
String equals,
Optional<String> trailing) {
sync(node);
TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
Optional<TypeWithDims> typeWithDims = Optional.of(extractedDims);
Optional<TypeWithDims> typeWithDims;
Tree type;
if (node.getType() != null) {
TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
typeWithDims = Optional.of(extractedDims);
type = extractedDims.node;
} else {
typeWithDims = Optional.empty();
type = null;
}
declareOne(
kind,
annotationsDirection,
Optional.of(node.getModifiers()),
extractedDims.node,
type,
node.getName(),
"",
equals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ class Java14 {
case WEDNESDAY -> 9;
};
}

{
for (var arg : List.of()) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ class Java14 {
case WEDNESDAY -> 9;
};
}

{
for (var arg : List.of()) {}
}
}

0 comments on commit e19b763

Please sign in to comment.