You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2019/11/10 10:12:06 UTC
[groovy] branch master updated: trivial refactor
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 7a8b01d trivial refactor
7a8b01d is described below
commit 7a8b01d1b9f342536e24fe5989e614d2f82fcc5a
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun Nov 10 04:11:50 2019 -0600
trivial refactor
---
.../groovy/transform/stc/StaticTypeCheckingVisitor.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index 4b81c30..a2dca5f 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -3792,19 +3792,17 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
}
protected boolean isClosureCall(final String name, final Expression objectExpression, final Expression arguments) {
- if (objectExpression instanceof ClosureExpression && "call".equals(name) || "doCall".equals(name)) return true;
+ if (objectExpression instanceof ClosureExpression && ("call".equals(name) || "doCall".equals(name))) return true;
if (isThisExpression(objectExpression)) {
FieldNode fieldNode = typeCheckingContext.getEnclosingClassNode().getDeclaredField(name);
- if (fieldNode != null) {
- ClassNode type = fieldNode.getType();
- if (CLOSURE_TYPE.equals(type) && !typeCheckingContext.getEnclosingClassNode().hasPossibleMethod(name, arguments)) {
- return true;
- }
+ if (fieldNode != null && CLOSURE_TYPE.equals(fieldNode.getType())
+ && !typeCheckingContext.getEnclosingClassNode().hasPossibleMethod(name, arguments)) {
+ return true;
}
- } else {
- if (!"call".equals(name) && !"doCall".equals(name)) return false;
+ } else if (!"call".equals(name) && !"doCall".equals(name)) {
+ return false;
}
- return (getType(objectExpression).equals(CLOSURE_TYPE));
+ return getType(objectExpression).equals(CLOSURE_TYPE);
}
protected void typeCheckClosureCall(final Expression callArguments, final ClassNode[] args, final Parameter[] parameters) {