You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/02/19 04:25:17 UTC

[groovy] 01/04: formatting

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

commit c343506cb86568d99ddc1d8fb781e62007116131
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 19 10:40:25 2020 +1000

    formatting
---
 .../groovy/ast/source/SourceBaseTestCase.groovy    | 45 ++++++++++++----------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/test/org/codehaus/groovy/ast/source/SourceBaseTestCase.groovy b/src/test/org/codehaus/groovy/ast/source/SourceBaseTestCase.groovy
index 4017fe5..1068c85 100644
--- a/src/test/org/codehaus/groovy/ast/source/SourceBaseTestCase.groovy
+++ b/src/test/org/codehaus/groovy/ast/source/SourceBaseTestCase.groovy
@@ -19,35 +19,38 @@
 package org.codehaus.groovy.ast.source
 
 import groovy.test.GroovyTestCase
-import org.codehaus.groovy.control.*
-import org.codehaus.groovy.control.io.*
-import org.codehaus.groovy.ast.stmt.*
+import org.codehaus.groovy.ast.stmt.BlockStatement
+import org.codehaus.groovy.control.CompilationUnit
+import org.codehaus.groovy.control.Phases
+import org.codehaus.groovy.control.SourceUnit
+import org.codehaus.groovy.control.io.StringReaderSource
 
 abstract class SourceBaseTestCase extends GroovyTestCase {
 
     private classNode
-    public classNode() {
-      if (classNode!=null) return node
-      def cu = new CompilationUnit(null,null, new GroovyClassLoader(this.class.classLoader))
-      def source = new StringReaderSource(script,cu.configuration)
-      def su = cu.addSource(new SourceUnit("Script_"+this.name, source, cu.configuration, cu.classLoader, cu.errorCollector))
-      cu.compile(Phases.CONVERSION)
-      classNode = cu.firstClassNode
-      return classNode
+
+    def classNode() {
+        if (classNode != null) return node
+        def cu = new CompilationUnit(null, null, new GroovyClassLoader(this.class.classLoader))
+        def source = new StringReaderSource(script, cu.configuration)
+        cu.addSource(new SourceUnit("Script_" + this.name, source, cu.configuration, cu.classLoader, cu.errorCollector))
+        cu.compile(Phases.CONVERSION)
+        classNode = cu.firstClassNode
+        return classNode
     }
-    
+
     def sourceInfo(expression) {
-      return [  expression.lineNumber,
+        return [expression.lineNumber,
                 expression.columnNumber,
                 expression.lastLineNumber,
-                expression.lastColumnNumber 
-             ]
+                expression.lastColumnNumber
+        ]
     }
-    
-    def statements(String method="run") {
-      def ret = classNode().getMethod(method).code
-      if (ret instanceof BlockStatement) return ret.statements
-      if (ret==null) return null
-      return [ret]
+
+    def statements(String method = "run") {
+        def ret = classNode().getMethod(method).code
+        if (ret instanceof BlockStatement) return ret.statements
+        if (ret == null) return null
+        return [ret]
     }
 }
\ No newline at end of file