groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [1/2] groovy git commit: Trivial refactoring: extract method `initPhaseOperations`
Date Sat, 06 Oct 2018 08:42:33 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 355c45522 -> d28483e97


Trivial refactoring: extract method `initPhaseOperations`


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/30c11c80
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/30c11c80
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/30c11c80

Branch: refs/heads/master
Commit: 30c11c80c112c78760b23cf2b0f3e54cd5df1a0a
Parents: 355c455
Author: Daniel Sun <sunlan@apache.org>
Authored: Sat Oct 6 16:39:51 2018 +0800
Committer: Daniel Sun <sunlan@apache.org>
Committed: Sat Oct 6 16:39:51 2018 +0800

----------------------------------------------------------------------
 .../codehaus/groovy/control/CompilationUnit.java   | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/30c11c80/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
index 011d4f6..0b14860 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
@@ -175,12 +175,7 @@ public class CompilationUnit extends ProcessingUnit {
         this.staticImportVisitor = new StaticImportVisitor();
         this.optimizer = new OptimizerVisitor(this);
 
-        phaseOperations = new LinkedList[Phases.ALL + 1];
-        newPhaseOperations = new LinkedList[Phases.ALL + 1];
-        for (int i = 0; i < phaseOperations.length; i++) {
-            phaseOperations[i] = new LinkedList();
-            newPhaseOperations[i] = new LinkedList();
-        }
+        initPhaseOperations();
         addPhaseOperation(new SourceUnitOperation() {
             public void call(SourceUnit source) throws CompilationFailedException {
                 source.parse();
@@ -274,6 +269,16 @@ public class CompilationUnit extends ProcessingUnit {
         this.classNodeResolver = new ClassNodeResolver();
     }
 
+    private void initPhaseOperations() {
+        int cnt = Phases.ALL + 1;
+        phaseOperations = new LinkedList[cnt];
+        newPhaseOperations = new LinkedList[cnt];
+        for (int i = 0; i < phaseOperations.length; i++) {
+            phaseOperations[i] = new LinkedList();
+            newPhaseOperations[i] = new LinkedList();
+        }
+    }
+
     private void applyCompilationCustomizers(CompilerConfiguration configuration) {
         // apply configuration customizers if any
         if (configuration != null) {


Mime
View raw message