Package org.rascalmpl.interpreter.control_exceptions

Examples of org.rascalmpl.interpreter.control_exceptions.Failure


    return result;
  }

  private static Result<IValue> callWith(List<AbstractFunction> candidates, Type[] argTypes, IValue[] argValues, Map<String, IValue> keyArgValues, boolean mustSucceed) {
    AbstractFunction failed = null;
    Failure failure = null;

    for (AbstractFunction candidate : candidates) {
      if ((candidate.hasVarArgs() && argValues.length >= candidate.getArity() - 1)
          || candidate.getArity() == argValues.length
          || candidate.hasKeywordArgs()) {
View Full Code Here


      __eval.setCurrentAST(this);
      __eval.notifyAboutSuspension(this);
     
      if (!this.getTarget().isEmpty()) {
        throw new Failure(Names.name(this.getTarget().getName()));
      }

      throw new Failure();

    }
View Full Code Here

      return true;
    }
       
    @Override
    public Result<IValue> call(Type[] argTypes, IValue[] argValues, Map<String, IValue> keyArgValues) {
      Failure f1 = null;
      try {
        try {
          return getRight().call(argTypes, argValues, keyArgValues);
        } catch(MatchFailed e) {
          // try another one
        } catch(Failure e) {
          // try another one
        }
         return getLeft().call(argTypes, argValues, keyArgValues);
      }
      catch (MatchFailed e) {
        List<AbstractFunction> candidates = Arrays.<AbstractFunction>asList((AbstractFunction) getLeft(), (AbstractFunction) getRight());
        throw new ArgumentsMismatch("+ composition", candidates, argTypes, ctx.getCurrentAST());
      }
      catch(Failure f2) {
        throw new Failure("Both functions in the '+' composition have failed:\n "
                  + getLeft().toString() + ",\n" + getRight().toString());
      }
    }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.control_exceptions.Failure

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.