Skip to content

Commit df914b5

Browse files
committed
restructure empty check
1 parent e783c1c commit df914b5

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,14 +5241,12 @@ protected ClassNode getType(final ASTNode node) {
52415241
}
52425242
if (variable instanceof Parameter) {
52435243
Parameter parameter = (Parameter) variable;
5244-
// check if param part of control structure - but not if inside instanceof
5245-
List<ClassNode> temporaryTypesForExpression = getTemporaryTypesForExpression(vexp);
5246-
if (temporaryTypesForExpression == null || temporaryTypesForExpression.isEmpty()) {
5244+
if (getTemporaryTypesForExpression(vexp).isEmpty()) { // not instanceof
5245+
// check if the parameter is part of a control structure (for loop)
52475246
type = typeCheckingContext.controlStructureVariables.get(parameter);
5248-
}
5249-
// now check for closure override
5250-
if (type == null && temporaryTypesForExpression == null) {
5251-
type = getTypeFromClosureArguments(parameter);
5247+
if (type == null) { // else check closure metadata
5248+
type = getTypeFromClosureArguments(parameter);
5249+
}
52525250
}
52535251
if (type != null) {
52545252
storeType(vexp, type);

0 commit comments

Comments
 (0)