Package com.orange.wink.parse.objects

Examples of com.orange.wink.parse.objects.Call


   * @throws WinkParseException
   */
  public static void getCalls(final AstNode n, final List<Call> result) throws WinkParseException {
    final ParseObject po = ParserUtils.resolveParseObject(n, true);
    if (po instanceof Call) {
      final Call call = (Call) po;
      result.add(call);
    } else if (po instanceof Function) {
      return;
    } else {
      for (final AstNode child : n.getChilds()) {
View Full Code Here


  /**
   * @param call
   * @throws WinkParseException
   */
  private void interpretExprResultCall(final ExprResultCall expr) throws WinkParseException {
    final Call call = expr.getCall();

    Namespace ns;
    ns = new Namespace();
    ns.appendNamespace(namespace);
    ns.appendNamespace(call.getNamespace());

    FunctionObject globalFunc;
    try {
      final ScriptObject so = resolveByNamespace(ns);
      if (!(so instanceof FunctionObject)) {
        return;
      }
      globalFunc = (FunctionObject) so;
    } catch (final WinkParseException e) {
      if (Constants.failOnUnresolvedNamespace) {
        throw new WinkParseException(ns + " not accessible in " + namespace + " - " + Ast.getPositionInfo(expr.getNode()), e);
      } else {
        System.err.println("WARN - " + ns + " not accessible in " + namespace + " - " + Ast.getPositionInfo(expr.getNode()) + " - " + e.getMessage());
        return;
      }
    }

    if (call instanceof DefineCall) {
      final Map<String, Namespace> argumentsMap = new HashMap<String, Namespace>();
      for (int i = 0; i < globalFunc.getParameters().size(); i++) {
        final String funcParam = globalFunc.getParameters().get(i);

        final Namespace nsc = new Namespace();
        nsc.addName(Constants.WINK_NAMESPACE);
        argumentsMap.put(funcParam, nsc);
      }

      final List<AstNode> childsGlobalFunc = globalFunc.getNode().getChilds();
      for (final AstNode cgf : childsGlobalFunc) {
        interpretCallSetProp(cgf, globalFunc, argumentsMap, true);
      }
    } else {
      if (globalFunc.getParameters().size() != call.getParameters().size()) {
        throw new WinkParseException("call arguments count does not match function parameter count [" + globalFunc + "]");
      }

      final Map<String, Namespace> argumentsMap = new HashMap<String, Namespace>();
      for (int i = 0; i < globalFunc.getParameters().size(); i++) {
        final String funcParam = globalFunc.getParameters().get(i);
        argumentsMap.put(funcParam, call.getParameters().get(i));
      }

      final List<AstNode> childsGlobalFunc = globalFunc.getNode().getChilds();
      for (final AstNode cgf : childsGlobalFunc) {
        interpretCallSetProp(cgf, globalFunc, argumentsMap, false);
View Full Code Here

TOP

Related Classes of com.orange.wink.parse.objects.Call

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.