Repository: groovy Updated Branches: refs/heads/master 560822ad5 -> 6eeee3844
Make some methods of `AstSpecificationCompiler` compile static Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6eeee384 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6eeee384 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6eeee384 Branch: refs/heads/master Commit: 6eeee3844d30d699ffe4e33545a9ec87c74df210 Parents: 560822a Author: danielsun1106 <[email protected]> Authored: Tue Mar 20 22:59:14 2018 +0800 Committer: danielsun1106 <[email protected]> Committed: Tue Mar 20 22:59:14 2018 +0800 ---------------------------------------------------------------------- .../ast/builder/AstSpecificationCompiler.groovy | 94 +++++++++++++++++--- 1 file changed, 83 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/6eeee384/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..f445858 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 @@ -109,6 +110,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates the DSL compiler. */ + @CompileStatic AstSpecificationCompiler(@DelegatesTo(AstSpecificationCompiler) Closure spec) { spec.delegate = this spec() @@ -117,6 +119,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Gets the current generated expression. */ + @CompileStatic List<ASTNode> getExpression() { return expression } @@ -132,7 +135,8 @@ class AstSpecificationCompiler implements GroovyInterceptable { * the list of Class objects that the method expects to have in the expression field when invoked. * @return * the portions of the expression field that adhere to the spec. - */ + */ + @CompileStatic private List<ASTNode> enforceConstraints(String methodName, List<Class> spec) { // enforce that the correct # arguments was passed @@ -160,7 +164,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") @@ -184,7 +189,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { * a specification of what arguments the constructor expects * @param argBlock * the single closure argument used during invocation - */ + */ private void makeNode(Class target, String typeAlias, List<Class<? super ASTNode>> ctorArgs, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { captureAndCreateNode(target.class.simpleName, argBlock) { target.newInstance(*enforceConstraints(typeAlias, ctorArgs)) @@ -199,7 +204,8 @@ class AstSpecificationCompiler implements GroovyInterceptable { * the class you are going to create * @param argBlock * the single closure argument used during invocation - */ + */ + @CompileStatic private void makeNodeFromList(Class target, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { //todo: add better error handling? captureAndCreateNode(target.simpleName, argBlock) { @@ -214,7 +220,8 @@ class AstSpecificationCompiler implements GroovyInterceptable { * the single closure argument used during invocation * @param input * the single String argument used during invocation - */ + */ + @CompileStatic private void makeListOfNodes(@DelegatesTo(AstSpecificationCompiler) Closure argBlock, String input) { captureAndCreateNode(input, argBlock) { new ArrayList(expression) @@ -228,7 +235,8 @@ class AstSpecificationCompiler implements GroovyInterceptable { * the single closure argument used during invocation * @param target * the target type - */ + */ + @CompileStatic private void makeArrayOfNodes(Object target, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { captureAndCreateNode(target.class.simpleName, argBlock) { expression.toArray(target) @@ -248,7 +256,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { * the single closure argument used during invocation * @param type * a type parameter - */ + */ private void makeNodeWithClassParameter(Class target, String alias, List<Class> spec, @DelegatesTo(AstSpecificationCompiler) Closure argBlock, Class type) { captureAndCreateNode(target.class.simpleName, argBlock) { expression.add(0, ClassHelper.make(type)) @@ -266,6 +274,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a CastExpression. */ + @CompileStatic void cast(Class type, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeWithClassParameter(CastExpression, 'cast', [ClassNode, Expression], argBlock, type) } @@ -273,6 +282,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ConstructorCallExpression. */ + @CompileStatic void constructorCall(Class type, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeWithClassParameter(ConstructorCallExpression, 'constructorCall', [ClassNode, Expression], argBlock, type) } @@ -280,6 +290,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a MethodCallExpression. */ + @CompileStatic void methodCall(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(MethodCallExpression, 'methodCall', [Expression, Expression, Expression], argBlock) } @@ -287,6 +298,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an AnnotationConstantExpression. */ + @CompileStatic void annotationConstant(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(AnnotationConstantExpression, 'annotationConstant', [AnnotationNode], argBlock) } @@ -294,6 +306,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a PostfixExpression. */ + @CompileStatic void postfix(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(PostfixExpression, 'postfix', [Expression, Token], argBlock) } @@ -301,6 +314,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a FieldExpression. */ + @CompileStatic void field(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(FieldExpression, 'field', [FieldNode], argBlock) } @@ -308,6 +322,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a MapExpression. */ + @CompileStatic void map(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeFromList(MapExpression, argBlock) } @@ -315,6 +330,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a TupleExpression. */ + @CompileStatic void tuple(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeFromList(TupleExpression, argBlock) } @@ -322,6 +338,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a MapEntryExpression. */ + @CompileStatic void mapEntry(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(MapEntryExpression, 'mapEntry', [Expression, Expression], argBlock) } @@ -329,6 +346,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a gString. */ + @CompileStatic void gString(String verbatimText, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeWithStringParameter(GStringExpression, 'gString', [String, List, List], argBlock, verbatimText) } @@ -337,7 +355,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a methodPointer. */ - + @CompileStatic void methodPointer(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(MethodPointerExpression, 'methodPointer', [Expression, Expression], argBlock) } @@ -345,6 +363,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a property. */ + @CompileStatic void property(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(PropertyExpression, 'property', [Expression, Expression], argBlock) } @@ -352,6 +371,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a RangeExpression. */ + @CompileStatic void range(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(RangeExpression, 'range', [Expression, Expression, Boolean], argBlock) } @@ -359,6 +379,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates EmptyStatement. */ + @CompileStatic void empty() { expression << EmptyStatement.INSTANCE } @@ -373,6 +394,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ImportNode. */ + @CompileStatic void importNode(Class target, String alias = null) { expression << new ImportNode(ClassHelper.make(target), alias) } @@ -380,6 +402,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a CatchStatement. */ + @CompileStatic void catchStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(CatchStatement, 'catchStatement', [Parameter, Statement], argBlock) } @@ -387,6 +410,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ThrowStatement. */ + @CompileStatic void throwStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ThrowStatement, 'throwStatement', [Expression], argBlock) } @@ -394,6 +418,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a SynchronizedStatement. */ + @CompileStatic void synchronizedStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(SynchronizedStatement, 'synchronizedStatement', [Expression, Statement], argBlock) } @@ -401,6 +426,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ReturnStatement. */ + @CompileStatic void returnStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ReturnStatement, 'returnStatement', [Expression], argBlock) } @@ -408,7 +434,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a TernaryExpression. */ - + @CompileStatic private void ternary(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(TernaryExpression, 'ternary', [BooleanExpression, Expression, Expression], argBlock) } @@ -417,6 +443,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ElvisOperatorExpression. */ + @CompileStatic void elvisOperator(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ElvisOperatorExpression, 'elvisOperator', [Expression, Expression], argBlock) } @@ -424,6 +451,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BreakStatement. */ + @CompileStatic void breakStatement(String label = null) { if (label) { expression << new BreakStatement(label) @@ -435,6 +463,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ContinueStatement. */ + @CompileStatic void continueStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock = null) { if (!argBlock) { expression << new ContinueStatement() @@ -446,6 +475,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Create a CaseStatement. */ + @CompileStatic void caseStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(CaseStatement, 'caseStatement', [Expression, Statement], argBlock) } @@ -453,6 +483,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BlockStatement. */ + @CompileStatic void defaultCase(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { block(argBlock) // same as arg block } @@ -460,6 +491,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a PrefixExpression. */ + @CompileStatic void prefix(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(PrefixExpression, 'prefix', [Token, Expression], argBlock) } @@ -467,6 +499,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a NotExpression. */ + @CompileStatic void not(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(NotExpression, 'not', [Expression], argBlock) } @@ -481,6 +514,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClassNode[]. */ + @CompileStatic void exceptions(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeArrayOfNodes([] as ClassNode[], argBlock) } @@ -488,6 +522,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of AnnotationNodes. */ + @CompileStatic void annotations(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<AnnotationNode>") } @@ -496,6 +531,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of MethodNodes. */ + @CompileStatic void methods(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<MethodNode>") } @@ -503,6 +539,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of ConstructorNodes. */ + @CompileStatic void constructors(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<ConstructorNode>") } @@ -510,6 +547,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of {@code PropertyNode}s. */ + @CompileStatic void properties(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<PropertyNode>") } @@ -517,6 +555,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of {@code FieldNode}s. */ + @CompileStatic void fields(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<FieldNode>") } @@ -524,7 +563,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of ConstantExpressions. */ - + @CompileStatic void strings(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<ConstantExpression>") } @@ -532,7 +571,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Designates a list of Expressions. */ - + @CompileStatic void values(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<Expression>") } @@ -547,6 +586,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ConstantExpression. */ + @CompileStatic void constant(Object value) { expression << new ConstantExpression(value) } @@ -554,6 +594,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an IfStatement. */ + @CompileStatic void ifStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(IfStatement, 'ifStatement', [BooleanExpression, Statement, Statement], argBlock) } @@ -561,6 +602,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a SpreadExpression. */ + @CompileStatic void spread(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(SpreadExpression, 'spread', [Expression], argBlock) } @@ -568,6 +610,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a SpreadMapExpression. */ + @CompileStatic void spreadMap(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(SpreadMapExpression, 'spreadMap', [Expression], argBlock) } @@ -575,6 +618,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a WhileStatement. */ + @CompileStatic void whileStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(WhileStatement, 'whileStatement', [BooleanExpression, Statement], argBlock) } @@ -582,6 +626,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Create a ForStatement. */ + @CompileStatic void forStatement(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ForStatement, 'forStatement', [Parameter, Expression, Statement], argBlock) } @@ -589,6 +634,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClosureListExpression. */ + @CompileStatic void closureList(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeFromList(ClosureListExpression, argBlock) } @@ -596,6 +642,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a DeclarationExpression. */ + @CompileStatic void declaration(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(DeclarationExpression, 'declaration', [Expression, Token, Expression], argBlock) } @@ -603,6 +650,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ListExpression. */ + @CompileStatic void list(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeFromList(ListExpression, argBlock) } @@ -610,6 +658,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BitwiseNegationExpression. */ + @CompileStatic void bitwiseNegation(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(BitwiseNegationExpression, 'bitwiseNegation', [Expression], argBlock) } @@ -617,6 +666,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClosureExpression. */ + @CompileStatic void closure(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ClosureExpression, 'closure', [Parameter[], Statement], argBlock) } @@ -624,6 +674,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BooleanExpression. */ + @CompileStatic void booleanExpression(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(BooleanExpression, 'booleanExpression', [Expression], argBlock) } @@ -631,6 +682,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BinaryExpression. */ + @CompileStatic void binary(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(BinaryExpression, 'binary', [Expression, Token, Expression], argBlock) } @@ -638,6 +690,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a UnaryPlusExpression. */ + @CompileStatic void unaryPlus(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(UnaryPlusExpression, 'unaryPlus', [Expression], argBlock) } @@ -645,6 +698,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClassExpression. */ + @CompileStatic void classExpression(Class type) { expression << new ClassExpression(ClassHelper.make(type)) } @@ -652,6 +706,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a UnaryMinusExpression */ + @CompileStatic void unaryMinus(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(UnaryMinusExpression, 'unaryMinus', [Expression], argBlock) } @@ -659,6 +714,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an AttributeExpression. */ + @CompileStatic void attribute(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(AttributeExpression, 'attribute', [Expression, Expression], argBlock) } @@ -666,6 +722,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ExpressionStatement. */ + @CompileStatic void expression(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNode(ExpressionStatement, 'expression', [Expression], argBlock) } @@ -673,6 +730,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a NamedArgumentListExpression. */ + @CompileStatic void namedArgumentList(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeNodeFromList(NamedArgumentListExpression, argBlock) } @@ -680,6 +738,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClassNode[]. */ + @CompileStatic void interfaces(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<ClassNode>") } @@ -687,6 +746,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a MixinNode[]. */ + @CompileStatic void mixins(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<MixinNode>") } @@ -694,6 +754,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a GenericsTypes[]. */ + @CompileStatic void genericsTypes(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, "List<GenericsTypes>") } @@ -701,6 +762,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a ClassNode. */ + @CompileStatic void classNode(Class target) { expression << ClassHelper.make(target, false) } @@ -708,6 +770,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a Parameter[]. */ + @CompileStatic void parameters(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeArrayOfNodes([] as Parameter[], argBlock) } @@ -715,6 +778,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a BlockStatement. */ + @CompileStatic void block(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { captureAndCreateNode("BlockStatement", argBlock) { return new BlockStatement(new ArrayList(expression), new VariableScope()) @@ -745,6 +809,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ArrayExpression. */ + @CompileStatic void array(Class type, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { captureAndCreateNode("ArrayExpression", argBlock) { new ArrayExpression(ClassHelper.make(type), new ArrayList(expression)) @@ -767,6 +832,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a list of upperBound ClassNodes. */ + @CompileStatic void upperBound(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { makeListOfNodes(argBlock, 'List<ClassNode>') } @@ -774,6 +840,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Create lowerBound ClassNode. */ + @CompileStatic void lowerBound(Class target) { expression << ClassHelper.make(target) } @@ -781,6 +848,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a 2 element list of name and Annotation. Used with Annotation Members. */ + @CompileStatic void member(String name, @DelegatesTo(AstSpecificationCompiler) Closure argBlock) { captureAndCreateNode("Annotation Member", argBlock) { [name, expression[0]] @@ -790,6 +858,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates an ArgumentListExpression. */ + @CompileStatic void argumentList(@DelegatesTo(AstSpecificationCompiler) Closure argBlock) { if (!argBlock) { expression << new ArgumentListExpression() @@ -908,6 +977,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a VariableExpression. */ + @CompileStatic void variable(String variable) { expression << new VariableExpression(variable) } @@ -944,6 +1014,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a RangeExpression. */ + @CompileStatic void range(Range range) { if (range == null) throw new IllegalArgumentException('Null: range') expression << new RangeExpression(new ConstantExpression(range.getFrom()), new ConstantExpression(range.getTo()), true) //default is inclusive @@ -964,6 +1035,7 @@ class AstSpecificationCompiler implements GroovyInterceptable { /** * Creates a mapEntry. */ + @CompileStatic void mapEntry(Map map) { map.entrySet().each { expression << new MapEntryExpression(
