You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/08/04 00:49:22 UTC

[4/4] groovy git commit: Make `captureAndCreateNode` CompileStatic

Make `captureAndCreateNode` CompileStatic


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 078c3815fd208a99302cd7b92017f9c5be97207e
Parents: 6afe5dd
Author: Daniel Sun <su...@apache.org>
Authored: Sat Aug 4 08:29:03 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sat Aug 4 08:48:56 2018 +0800

----------------------------------------------------------------------
 .../groovy/ast/builder/AstSpecificationCompiler.groovy         | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/078c3815/src/main/groovy/org/codehaus/groovy/ast/builder/AstSpecificationCompiler.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/org/codehaus/groovy/ast/builder/AstSpecificationCompiler.groovy b/src/main/groovy/org/codehaus/groovy/ast/builder/AstSpecificationCompiler.groovy
index e033af8..c596a66 100644
--- a/src/main/groovy/org/codehaus/groovy/ast/builder/AstSpecificationCompiler.groovy
+++ b/src/main/groovy/org/codehaus/groovy/ast/builder/AstSpecificationCompiler.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.AnnotationNode
 import org.codehaus.groovy.ast.ClassHelper
@@ -160,7 +161,8 @@ class AstSpecificationCompiler implements GroovyInterceptable {
     *       the actual parameters being specified for the node
     * @param constructorStatement
     *       the type specific construction code that will be run
-    */ 
+    */
+    @CompileStatic
     private void captureAndCreateNode(String name, @DelegatesTo(AstSpecificationCompiler) Closure argBlock, Closure constructorStatement) {
         if (!argBlock) throw new IllegalArgumentException("nodes of type $name require arguments to be specified")
 
@@ -170,7 +172,7 @@ class AstSpecificationCompiler implements GroovyInterceptable {
         def result = constructorStatement(expression) // invoke custom constructor for node
         expression.clear()
         expression.addAll(oldProps)
-        expression.add(result)
+        ((List) expression).add(result)
     }
 
     /**