Package com.stuffwithstuff.magpie.interpreter

Examples of com.stuffwithstuff.magpie.interpreter.Callable


    public Obj invoke(Context context, Obj left, Obj right) {
      FnObj function = left.asFn();
      Obj fnArg = right;
     
      // Make sure the argument matches the function's pattern.
      Callable callable = function.getCallable();
      if (!PatternTester.test(context, callable.getPattern(), fnArg,
          callable.getClosure())) {
        throw context.error(Name.NO_METHOD_ERROR, "The argument \"" +
            context.getInterpreter().evaluateToString(fnArg) + "\" does not match the " +
            "function's pattern " + callable.getPattern());
      }

      return function.invoke(context, fnArg);
    }
View Full Code Here


    Pattern pattern = parsed.getValue();
   
    Scope scope = mInterpreter.getBaseModule().getScope();
   
    // Construct the method.
    Callable callable = new IntrinsicCallable(pattern, doc, new MethodWrapper(method), scope);
   
    // Register it.
    scope.define(name, callable);
  }
View Full Code Here

      Doc docAnnotation = (Doc) innerClass.getAnnotation(Doc.class);
      if (docAnnotation != null) {
        doc = docAnnotation.value();
      }
     
      Callable callable = new IntrinsicCallable(pattern, doc, (Intrinsic) instance, scope);
     
      // Register it.
      scope.define(name, callable);
     
    } catch (SecurityException e) {
View Full Code Here

TOP

Related Classes of com.stuffwithstuff.magpie.interpreter.Callable

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.