groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Make `AstBuilder` and `AstStringCompiler` compile static
Date Tue, 20 Mar 2018 11:17:37 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X b07216df6 -> 93e145732


Make `AstBuilder` and `AstStringCompiler` compile static

(cherry picked from commit 560822a)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 93e1457322fb300b82569666908c6cceeb593839
Parents: b07216d
Author: sunlan <sunlan@apache.org>
Authored: Tue Mar 20 18:54:00 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Mar 20 19:17:28 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/lang/GroovyCodeSource.java               | 2 +-
 .../groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy    | 5 +++--
 .../org/codehaus/groovy/ast/builder/AstStringCompiler.groovy    | 4 +++-
 3 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/93e14573/src/main/groovy/groovy/lang/GroovyCodeSource.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/GroovyCodeSource.java b/src/main/groovy/groovy/lang/GroovyCodeSource.java
index a5a2bb1..18e84f1 100644
--- a/src/main/groovy/groovy/lang/GroovyCodeSource.java
+++ b/src/main/groovy/groovy/lang/GroovyCodeSource.java
@@ -210,7 +210,7 @@ public class GroovyCodeSource {
         return encoding;
     }
 
-    CodeSource getCodeSource() {
+    public CodeSource getCodeSource() {
         return codeSource;
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/93e14573/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy b/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
index 24dcdd6..3c5efc9 100644
--- a/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
+++ b/src/main/groovy/org/codehaus/groovy/ast/builder/AstBuilder.groovy
@@ -18,6 +18,7 @@
  */
 package org.codehaus.groovy.ast.builder
 
+import groovy.transform.CompileStatic
 import org.codehaus.groovy.ast.ASTNode
 import org.codehaus.groovy.ast.stmt.BlockStatement
 import org.codehaus.groovy.control.CompilePhase
@@ -33,7 +34,7 @@ import org.codehaus.groovy.control.CompilePhase
  *
  * @author Hamlet D'Arcy
  */
-
+@CompileStatic
 public class AstBuilder {
 
     /**
@@ -142,4 +143,4 @@ Are you sure you are using it correctly?
         def properties = new AstSpecificationCompiler(specification)
         return properties.expression
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/93e14573/src/main/groovy/org/codehaus/groovy/ast/builder/AstStringCompiler.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/org/codehaus/groovy/ast/builder/AstStringCompiler.groovy b/src/main/groovy/org/codehaus/groovy/ast/builder/AstStringCompiler.groovy
index 1ea3970..ec18993 100644
--- a/src/main/groovy/org/codehaus/groovy/ast/builder/AstStringCompiler.groovy
+++ b/src/main/groovy/org/codehaus/groovy/ast/builder/AstStringCompiler.groovy
@@ -18,6 +18,7 @@
  */
 package org.codehaus.groovy.ast.builder
 
+import groovy.transform.CompileStatic
 import groovy.transform.PackageScope
 import org.codehaus.groovy.ast.ASTNode
 import org.codehaus.groovy.ast.ModuleNode
@@ -30,6 +31,7 @@ import org.codehaus.groovy.control.CompilerConfiguration
  *
  * @author Hamlet D'Arcy
  */
+@CompileStatic
 @PackageScope class AstStringCompiler {
     
     /**
@@ -49,7 +51,7 @@ import org.codehaus.groovy.control.CompilerConfiguration
         cu.addSource(codeSource.getName(), script);
         cu.compile(compilePhase.getPhaseNumber())
         // collect all the ASTNodes into the result, possibly ignoring the script body if
desired
-        return cu.ast.modules.inject([]) {List acc, ModuleNode node ->
+        return (List<ASTNode>) cu.getAST().modules.inject([]) {List acc, ModuleNode
node ->
             if (node.statementBlock) acc.add(node.statementBlock)
             node.classes?.each {
                 if (!(it.name == scriptClassName && statementsOnly)) {


Mime
View raw message