This is an automated email from the ASF dual-hosted git repository.
paulk 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 7cb7566 display method information a little more nicely
7cb7566 is described below
commit 7cb7566f93eef89daf835308d586f3a3ac7c1e81
Author: Paul King <[email protected]>
AuthorDate: Sun May 2 11:28:56 2021 +1000
display method information a little more nicely
---
.../console/ui/ScriptToTreeNodeAdapter.groovy | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git
a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy
b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy
index f2f0fb3..4912cdf 100644
---
a/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy
+++
b/subprojects/groovy-console/src/main/groovy/groovy/console/ui/ScriptToTreeNodeAdapter.groovy
@@ -400,28 +400,41 @@ class TreeNodeBuildingNodeOperation implements
CompilationUnit.IPrimaryClassNode
}
private void doCollectMethodData(allMethods, List methods) {
- methods?.each {MethodNode methodNode ->
+ methods?.each { MethodNode methodNode ->
def ggrandchild = adapter.make(methodNode)
allMethods.add(ggrandchild)
+ def returnType = nodeMaker.makeNode("Return Type")
+ def gggrandchild = adapter.make(methodNode.returnType)
+ ggrandchild.add(returnType)
+ returnType.add(gggrandchild)
+
// print out parameters of method
- methodNode.parameters?.each {Parameter parameter ->
- def gggrandchild = adapter.make(parameter)
+ methodNode.parameters?.each { Parameter parameter ->
+ gggrandchild = adapter.make(parameter)
ggrandchild.add(gggrandchild)
if (parameter.initialExpression) {
TreeNodeBuildingVisitor visitor = new
TreeNodeBuildingVisitor(adapter)
parameter.initialExpression.visit(visitor)
if (visitor.currentNode)
gggrandchild.add(visitor.currentNode)
}
+ def type = nodeMaker.makeNode("Type")
+ type.add(adapter.make(parameter.type))
+ gggrandchild.add(type)
collectAnnotationData(gggrandchild, 'Annotations', parameter)
}
// print out code of method
TreeNodeBuildingVisitor visitor = new
TreeNodeBuildingVisitor(adapter)
if (methodNode.code) {
+ def body = nodeMaker.makeNode("Body")
methodNode.code.visit(visitor)
- if (visitor.currentNode) ggrandchild.add(visitor.currentNode)
+ if (visitor.currentNode) {
+ ggrandchild.add(body)
+ body.add(visitor.currentNode)
+ }
}
+
collectAnnotationData(ggrandchild, 'Annotations', methodNode)
}
}