예제 #1
0
        private PartialCall(Value arg, PartialCall last, bool right = false)
        {
            ArgumentsLeft = last.ArgumentsLeft - 1;
            if (right && ArgumentsLeft != 1) throw new RightArgumentPassedToNonInfixFunction();
            Function = last.Function;
            Argument = arg;
            this.last = last;
            this.right = right;

            Expecting = GetExpecting();
        }
예제 #2
0
 public PartialCall Add(Value argument)
 {
     //if (CheckArgument(argument) == MatchType.Mismatch) throw new NoMatchingSignature(SignatureMismatchType.Individual);
     if (Expecting == ValueType.Identifier) argument = new Identifier(argument.Var.LastName);
     var call = new PartialCall(argument, this);
     if (right)
     {
         var temp = new PartialCall(Argument, call);
         temp.ArgumentsLeft = 0; //ArgumentsLeft needs to be fixed to 0 because this additional PartialCall doesn't actually need to decrement it
         call.last = last;
         return temp;
     }
     return call;
 }
예제 #3
0
 private void AddFunction(PartialCall partialCall)
 {
     if (fixity != Hype.Fixity.Prefix && partialCall.ArgumentsLeft != 2)
     {
         throw new ExpressionException("This overload can't be added to an infix function because it does not require exactly two arguments.");
     }
     PotentialMatches.Add(partialCall);
 }
예제 #4
0
 private void AddFunction(IInvokable func)
 {
     var partialCall = new PartialCall(func);
     AddFunction(partialCall);
 }