@Override
 public void applyToDependentParsedCode(IParsedCode parsedCode) {
   if (parsedCode == null) {
     throw new IllegalArgumentException("parsedCode argument can't be null!");
   }
   if (parsedCode.getTopNode() instanceof XlsModuleSyntaxNode) {
     XlsModuleSyntaxNode xlsModuleSyntaxNode = (XlsModuleSyntaxNode) parsedCode.getTopNode();
     for (String value : getImports()) {
       xlsModuleSyntaxNode.addImport(value);
     }
   }
 }
Пример #2
0
  public IBoundCode bind(IParsedCode parsedCode, IBindingContextDelegator bindingContextDelegator) {

    XlsModuleSyntaxNode moduleNode = (XlsModuleSyntaxNode) parsedCode.getTopNode();

    OpenL openl = null;

    try {
      openl = makeOpenL(moduleNode);
    } catch (OpenConfigurationException ex) {

      OpenlSyntaxNode syntaxNode = moduleNode.getOpenlNode();

      SyntaxNodeException error =
          SyntaxNodeExceptionUtils.createError("Error Creating OpenL", ex, syntaxNode);
      BindHelper.processError(error);

      return BindHelper.makeInvalidCode(parsedCode, syntaxNode, new SyntaxNodeException[] {error});
    }

    IOpenBinder openlBinder = openl.getBinder();
    IBindingContext bindingContext = openlBinder.makeBindingContext();
    bindingContext = BindHelper.delegateContext(bindingContext, bindingContextDelegator);

    if (parsedCode.getExternalParams() != null) {
      bindingContext.setExternalParams(parsedCode.getExternalParams());
    }

    IBoundNode topNode = null;

    if (!parsedCode.getCompiledDependencies().isEmpty()) {
      topNode =
          bindWithDependencies(
              moduleNode, openl, bindingContext, parsedCode.getCompiledDependencies());
    } else {
      topNode = bind(moduleNode, openl, bindingContext);
    }

    return new BoundCode(parsedCode, topNode, bindingContext.getErrors(), 0);
  }