Java Code Examples for org.codehaus.groovy.ast.expr.GStringExpression
The following examples show how to use
org.codehaus.groovy.ast.expr.GStringExpression. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: groovy Source File: InnerClassVisitorHelper.java License: Apache License 2.0 | 6 votes |
protected static void setPropertySetterDispatcher(BlockStatement block, Expression thiz, Parameter[] parameters) { List<ConstantExpression> gStringStrings = new ArrayList<ConstantExpression>(); gStringStrings.add(new ConstantExpression("")); gStringStrings.add(new ConstantExpression("")); List<Expression> gStringValues = new ArrayList<Expression>(); gStringValues.add(new VariableExpression(parameters[0])); block.addStatement( new ExpressionStatement( new BinaryExpression( new PropertyExpression( thiz, new GStringExpression("$name", gStringStrings, gStringValues) ), Token.newSymbol(Types.ASSIGN, -1, -1), new VariableExpression(parameters[1]) ) ) ); }
Example 2
Source Project: groovy Source File: InnerClassVisitorHelper.java License: Apache License 2.0 | 6 votes |
protected static void setMethodDispatcherCode(BlockStatement block, Expression thiz, Parameter[] parameters) { List<ConstantExpression> gStringStrings = new ArrayList<ConstantExpression>(); gStringStrings.add(new ConstantExpression("")); gStringStrings.add(new ConstantExpression("")); List<Expression> gStringValues = new ArrayList<Expression>(); gStringValues.add(new VariableExpression(parameters[0])); block.addStatement( new ReturnStatement( new MethodCallExpression( thiz, new GStringExpression("$name", gStringStrings, gStringValues), new ArgumentListExpression( new SpreadExpression(new VariableExpression(parameters[1])) ) ) ) ); }
Example 3
Source Project: groovy-language-server Source File: ASTNodeVisitor.java License: Apache License 2.0 | 5 votes |
public void visitGStringExpression(GStringExpression node) { pushASTNode(node); try { super.visitGStringExpression(node); } finally { popASTNode(); } }
Example 4
Source Project: groovy Source File: InnerClassVisitorHelper.java License: Apache License 2.0 | 5 votes |
protected static void setPropertyGetterDispatcher(BlockStatement block, Expression thiz, Parameter[] parameters) { List<ConstantExpression> gStringStrings = new ArrayList<ConstantExpression>(); gStringStrings.add(new ConstantExpression("")); gStringStrings.add(new ConstantExpression("")); List<Expression> gStringValues = new ArrayList<Expression>(); gStringValues.add(new VariableExpression(parameters[0])); block.addStatement( new ReturnStatement( new PropertyExpression( thiz, new GStringExpression("$name", gStringStrings, gStringValues) ) ) ); }
Example 5
Source Project: groovy Source File: AsmClassGenerator.java License: Apache License 2.0 | 5 votes |
@Override public void visitGStringExpression(final GStringExpression expression) { MethodVisitor mv = controller.getMethodVisitor(); mv.visitTypeInsn(NEW, "org/codehaus/groovy/runtime/GStringImpl"); mv.visitInsn(DUP); int size = expression.getValues().size(); BytecodeHelper.pushConstant(mv, size); mv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); for (int i = 0; i < size; i += 1) { mv.visitInsn(DUP); BytecodeHelper.pushConstant(mv, i); expression.getValue(i).visit(this); controller.getOperandStack().box(); mv.visitInsn(AASTORE); } controller.getOperandStack().remove(size); List<ConstantExpression> strings = expression.getStrings(); size = strings.size(); BytecodeHelper.pushConstant(mv, size); mv.visitTypeInsn(ANEWARRAY, "java/lang/String"); for (int i = 0; i < size; i += 1) { mv.visitInsn(DUP); BytecodeHelper.pushConstant(mv, i); controller.getOperandStack().pushConstant(strings.get(i)); controller.getOperandStack().box(); mv.visitInsn(AASTORE); } controller.getOperandStack().remove(size); mv.visitMethodInsn(INVOKESPECIAL, "org/codehaus/groovy/runtime/GStringImpl", "<init>", "([Ljava/lang/Object;[Ljava/lang/String;)V", false); controller.getOperandStack().push(ClassHelper.GSTRING_TYPE); }
Example 6
Source Project: netbeans Source File: PathFinderVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(GStringExpression node) { if (isInside(node, line, column)) { super.visitGStringExpression(node); } }
Example 7
Source Project: groovy Source File: ASTFinder.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(final GStringExpression expression) { super.visitGStringExpression(expression); tryFind(GStringExpression.class, expression); }
Example 8
Source Project: groovy Source File: ContextualClassCodeVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(final GStringExpression expression) { pushContext(expression); super.visitGStringExpression(expression); popContext(); }
Example 9
Source Project: groovy Source File: SecureASTCustomizer.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(final GStringExpression expression) { assertExpressionAuthorized(expression); visitListOfExpressions(expression.getStrings()); visitListOfExpressions(expression.getValues()); }
Example 10
Source Project: groovy Source File: TransformingCodeVisitor.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(final GStringExpression expression) { super.visitGStringExpression(expression); trn.visitGStringExpression(expression); }
Example 11
Source Project: groovy Source File: CodeVisitorSupport.java License: Apache License 2.0 | 4 votes |
@Override public void visitGStringExpression(GStringExpression expression) { visitListOfExpressions(expression.getStrings()); visitListOfExpressions(expression.getValues()); }
Example 12
Source Project: groovy Source File: ClassCompletionVerifier.java License: Apache License 2.0 | 4 votes |
public void visitGStringExpression(GStringExpression expression) { super.visitGStringExpression(expression); for (ConstantExpression ce : expression.getStrings()) { checkStringExceedingMaximumLength(ce); } }
Example 13
Source Project: groovy Source File: GroovyCodeVisitor.java License: Apache License 2.0 | votes |
void visitGStringExpression(GStringExpression expression);