Esempio n. 1
0
 public void preBind() {
   try {
     preBindeding = true;
     try {
       moduleContext.pushErrors();
       IMemberBoundNode memberBoundNode =
           XlsBinder.this.beginBind(tableSyntaxNode, module, openl, moduleContext);
       childrens[index] = memberBoundNode;
       if (memberBoundNode != null) {
         try {
           memberBoundNode.addTo(module);
         } catch (OpenlNotCheckedException e) {
           SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(e, tableSyntaxNode);
           processError(error, tableSyntaxNode, moduleContext);
         }
       }
     } finally {
       List<SyntaxNodeException> syntaxNodeExceptions = moduleContext.popErrors();
       for (SyntaxNodeException e : syntaxNodeExceptions) {
         addModuleContextError(e); // Workaround for syntax node
         // errors
       }
     }
     if (recursiveOpenMethodPreBinderMethods != null) {
       for (RecursiveOpenMethodPreBinder recursiveOpenMethodPreBinderMethod :
           recursiveOpenMethodPreBinderMethods) {
         recursiveOpenMethodPreBinderMethod.preBind();
       }
     }
   } finally {
     preBindeding = false;
   }
 }
Esempio n. 2
0
  protected IBoundNode bindInternal(
      XlsModuleSyntaxNode moduleSyntaxNode,
      XlsModuleOpenClass module,
      TableSyntaxNode[] tableSyntaxNodes,
      OpenL openl,
      RulesModuleBindingContext moduleContext) {

    IMemberBoundNode[] children = new IMemberBoundNode[tableSyntaxNodes.length];
    OpenMethodHeader[] openMethodHeaders = new OpenMethodHeader[tableSyntaxNodes.length];

    for (int i = 0;
        i < tableSyntaxNodes.length;
        i++) { // Add methods that should be compiled recursively
      if (isExecutableTableSyntaxNode(tableSyntaxNodes[i])) {
        openMethodHeaders[i] =
            addMethodHeaderToContext(
                module, tableSyntaxNodes[i], openl, moduleContext, children, i);
      }
    }

    for (int i = 0; i < tableSyntaxNodes.length; i++) {
      if (!isExecutableTableSyntaxNode(tableSyntaxNodes[i])) {
        IMemberBoundNode child = beginBind(tableSyntaxNodes[i], module, openl, moduleContext);
        children[i] = child;
        if (child != null) {
          try {
            child.addTo(module);
          } catch (OpenlNotCheckedException e) {
            SyntaxNodeException error =
                SyntaxNodeExceptionUtils.createError(e, tableSyntaxNodes[i]);
            processError(error, tableSyntaxNodes[i], moduleContext);
          }
        }
      }
    }

    for (int i = 0; i < children.length; i++) {
      if (isExecutableTableSyntaxNode(tableSyntaxNodes[i])) {
        moduleContext.preBindMethod(openMethodHeaders[i]);
      }
    }

    for (int i = 0; i < children.length; i++) {
      if (children[i] != null) {
        finilizeBind(children[i], tableSyntaxNodes[i], moduleContext);
      }
    }

    processModuleContextErrors(moduleContext);

    if (moduleContext.isExecutionMode()) {
      removeDebugInformation(children, tableSyntaxNodes, moduleContext);
    }

    return new ModuleNode(moduleSyntaxNode, moduleContext.getModule());
  }
Esempio n. 3
0
  protected void finilizeBind(
      IMemberBoundNode memberBoundNode,
      TableSyntaxNode tableSyntaxNode,
      RulesModuleBindingContext moduleContext) {

    try {
      memberBoundNode.finalizeBind(moduleContext);
    } catch (SyntaxNodeException error) {
      processError(error, tableSyntaxNode, moduleContext);
    } catch (CompositeSyntaxNodeException ex) {
      if (ex.getErrors() != null) {
        for (SyntaxNodeException error : ex.getErrors()) {
          processError(error, tableSyntaxNode, moduleContext);
        }
      }
    } catch (Throwable t) {
      SyntaxNodeException error = SyntaxNodeExceptionUtils.createError(t, tableSyntaxNode);
      processError(error, tableSyntaxNode, moduleContext);
    }
  }