Java Code Examples for org.codehaus.groovy.ast.ModuleNode#getMethods()

The following examples show how to use org.codehaus.groovy.ast.ModuleNode#getMethods() . 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 File: PowsyblDslAstTransformation.java    From powsybl-core with Mozilla Public License 2.0 6 votes vote down vote up
protected void visit(SourceUnit sourceUnit, ClassCodeExpressionTransformer transformer) {
    LOGGER.trace("Apply AST transformation");
    ModuleNode ast = sourceUnit.getAST();
    BlockStatement blockStatement = ast.getStatementBlock();

    if (DEBUG) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(AstUtil.toString(blockStatement));
        }
    }

    List<MethodNode> methods = ast.getMethods();
    for (MethodNode methodNode : methods) {
        methodNode.getCode().visit(transformer);
    }

    blockStatement.visit(transformer);

    if (DEBUG) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(AstUtil.toString(blockStatement));
        }
    }
}
 
Example 2
Source File: CalculatedTimeSeriesDslAstTransformation.java    From powsybl-core with Mozilla Public License 2.0 5 votes vote down vote up
protected void visit(SourceUnit sourceUnit, ClassCodeExpressionTransformer transformer, boolean debug) {
    LOGGER.trace("Apply AST transformation");
    ModuleNode ast = sourceUnit.getAST();
    BlockStatement blockStatement = ast.getStatementBlock();

    List<MethodNode> methods = ast.getMethods();
    for (MethodNode methodNode : methods) {
        methodNode.getCode().visit(transformer);
    }

    blockStatement.visit(transformer);
}
 
Example 3
Source File: ValidationCodeVisitorSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public ValidationCodeVisitorSupport(final IValidationContext context, final Expression expression, final ModuleNode node) {
    dependenciesName = retrieveDependenciesList(expression);
    okStatus = context.createSuccessStatus();
    errorStatus = new MultiStatus(ValidationPlugin.PLUGIN_ID, IStatus.OK, "", null);
    this.context = context;
    for (final MethodNode method : node.getMethods()) {
        declaredMethodsSignature.add(new MethodSignature(method.getName(), method.getParameters().length));
    }
}