Examples of AbstractFunction


Examples of org.rascalmpl.interpreter.result.AbstractFunction

     
      if (func == null) {
        throw new UndeclaredVariable(function, name);
      }
     
      AbstractFunction main = func.getFunctions().get(0);
     
      if (func.getFunctions().size() > 1) {
        throw new CommandlineError("should only have one main function", main);
      }
     
      if (main.getArity() == 1) {
        return func.call(getMonitor(), new Type[] { tf.listType(tf.stringType()) },new IValue[] { parsePlainCommandLineArgs(commandline)}, null).getValue();
      }
      else if (main.hasKeywordArgs() && main.getArity() == 0) {
        Map<String, IValue> args = parseKeywordCommandLineArgs(monitor, commandline, main);
        return func.call(getMonitor(), new Type[] { },new IValue[] {}, args).getValue();
      }
      else {
        throw new CommandlineError("main function should either have one argument of type list[str], or keyword parameters", main);
View Full Code Here

Examples of org.rascalmpl.interpreter.result.AbstractFunction

  private void runTests(ModuleEnvironment env, List<AbstractFunction> tests) {
    testResultListener.start(tests.size());

//    try {
    for (int i = tests.size() - 1; i >= 0; i--) {
      AbstractFunction test = tests.get(i);
      if (test.hasTag("ignore") || test.hasTag("Ignore") || test.hasTag("ignoreInterpreter") || test.hasTag("IgnoreInterpreter")) {
        continue;
      }

      try{
        QuickCheck qc = QuickCheck.getInstance();
        StringWriter sw = new StringWriter();
        PrintWriter out = new PrintWriter(sw);
        int maxDepth = Cobra.readIntTag(test, Cobra.MAXDEPTH, 5);
        int tries = Cobra.readIntTag(test, Cobra.TRIES, 500);

        boolean result = qc.quickcheck(test, maxDepth, tries, false, out);
        if (!result) {
          out.flush();
          testResultListener.report(false, test.getName(), test.getAst().getLocation(), sw.getBuffer()
              .toString(), null);
        } else {
          testResultListener.report(true, test.getName(), test.getAst().getLocation(), sw.getBuffer()
              .toString(), null);
        }
      }
      catch(StaticError e) {
        testResultListener.report(false, test.getName(), test.getAst().getLocation(), e.getMessage(), e);
      }
      catch(Throw e){
        testResultListener.report(false, test.getName(), test.getAst().getLocation(), e.getMessage(), e);
      }
      catch(Throwable e){
        testResultListener.report(false, test.getName(), test.getAst().getLocation(), e.getMessage(), e);
      }
    }
    //    }
    //    finally {
    testResultListener.done();
View Full Code Here

Examples of org.rascalmpl.interpreter.result.AbstractFunction

    if (function instanceof OverloadedFunction) {
      OverloadedFunction of = (OverloadedFunction) function;
      return computeMessage(of.getName(), of.getFunctions(), argTypes);
    }
    else {
      AbstractFunction func = (AbstractFunction) function;
      return computeMessage(func.getName(), Arrays.<AbstractFunction>asList(func), argTypes);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.