groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [2/2] groovy git commit: Trivial refactoring: extract method `addPhaseOperations`
Date Sat, 06 Oct 2018 08:42:34 GMT
Trivial refactoring: extract method `addPhaseOperations`


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

Branch: refs/heads/master
Commit: d28483e97deca733913c618a9e4230fc6ed8495d
Parents: 30c11c8
Author: Daniel Sun <sunlan@apache.org>
Authored: Sat Oct 6 16:42:02 2018 +0800
Committer: Daniel Sun <sunlan@apache.org>
Committed: Sat Oct 6 16:42:02 2018 +0800

----------------------------------------------------------------------
 .../groovy/control/CompilationUnit.java         | 34 +++++++++++---------
 1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/d28483e9/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 0b14860..5ecc461 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
@@ -176,6 +176,25 @@ public class CompilationUnit extends ProcessingUnit {
         this.optimizer = new OptimizerVisitor(this);
 
         initPhaseOperations();
+        addPhaseOperations();
+
+        applyCompilationCustomizers(configuration);
+
+        this.classgenCallback = null;
+        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 addPhaseOperations() {
         addPhaseOperation(new SourceUnitOperation() {
             public void call(SourceUnit source) throws CompilationFailedException {
                 source.parse();
@@ -262,21 +281,6 @@ public class CompilationUnit extends ProcessingUnit {
                 }
             }
         }, Phases.INSTRUCTION_SELECTION);
-
-        applyCompilationCustomizers(configuration);
-
-        this.classgenCallback = null;
-        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) {


Mime
View raw message