Exemplo n.º 1
0
        }     //method

        protected void InvokeDynamic(EvaluationContext context)
        {
            NameRef.Evaluate(context);
            Closure target;

            try {
                target = (Closure)context.CurrentResult;
                if (target.MethodName == null)
                {
                    target.MethodName = NameRef.Name;
                }
            } catch (InvalidCastException castExc) {
                throw new Irony.Runtime.RuntimeException("Method [" + NameRef.Name + "] not found or method reference is not set.", castExc, NameRef.Location);
            } catch (NullReferenceException) {
                throw new Irony.Runtime.RuntimeException("Method reference is not set in variable " + NameRef.Name, null, NameRef.Location);
            }

            EvaluateArgs(context, target.BindingInfo);
            if (_isTail)
            {
                context.Tail = target;
                return;
            }
            //execute non-tail call
            target.Evaluate(context);
            if (context.Tail == null)
            {
                return;
            }
            //check returning tail
            while (context.Tail != null)
            {
                Closure tail = context.Tail;
                context.Tail = null;
                tail.Evaluate(context);
            }
            context.CallArgs = null;
        }
Exemplo n.º 2
0
 protected override void DoEvaluate(EvaluationContext context)
 {
     Expression.Evaluate(context);
     Identifier.Evaluate(context); //writes the value into the slot
 }