Package loop.ast.script

Examples of loop.ast.script.FunctionDecl


        return true;
    }

    // Keep searching up the stack until we resolve this symbol or die trying!.
    while (iterator.hasPrevious()) {
      FunctionDecl functionDecl = iterator.previous().function;
      List<Node> children = functionDecl.children();

      // Then attempt to resolve in function scope.
      if (resolveVarInNodes(name, children))
        return true;
      else if (resolveVarInNodes(name, functionDecl.whereBlock()))
        return true;
    }

    // Finally this could be a function pointer.
    return resolveCall(name) != null;
View Full Code Here


  }

  private FunctionDecl resolveCall(String name) {
    ListIterator<FunctionContext> iterator = functionStack.listIterator(functionStack.size());
    while (iterator.hasPrevious()) {
      FunctionDecl functionDecl = iterator.previous().function;
      List<Node> whereBlock = functionDecl.whereBlock();

      // Well, first see if this is a direct call (usually catches recursion).
      if (name.equals(functionDecl.name()))
        return functionDecl;

      // First attempt to resolve in local function scope.
      for (Node node : whereBlock) {
        if (node instanceof FunctionDecl) {
          FunctionDecl inner = (FunctionDecl) node;
          if (name.equals(inner.name()))
            return inner;
        }
      }
    }

    // Then attempt to resolve in module(s).
    FunctionDecl target = unit.resolveFunction(name, true /* resolve in deps */);
    if (target != null)
      return target;

    return null;
  }
View Full Code Here

      Guard guard = (Guard) bloated;

      reduce(guard.expression, false);
      reduce(guard.line, true);
    } else if (bloated instanceof FunctionDecl) {
      FunctionDecl decl = (FunctionDecl) bloated;
      if (!decl.whereBlock().isEmpty()) {
        for (Node node : decl.whereBlock()) {
          reduce(node, true);
        }
      }
    }
View Full Code Here

TOP

Related Classes of loop.ast.script.FunctionDecl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.