Esempio n. 1
0
        public ResultMemory(Bindings global)
        {
            _global = global;

            global.AddBinding(m1);
            global.AddBinding(m2);
            global.AddBinding(m3);
        }
Esempio n. 2
0
        public Bindings BindArguments(Bindings scope, IEnumerable<Expression> args)
        {
            var invocationScope = new Bindings { ParentScope = scope };

            // TODO: enhance when optional parameter length added
            if (_parameters != null && _parameters.Elements.Count != args.Count())
                throw new MistException(string.Format("Wrong number of arguments ({0} instead of {1})",
                    args.Count(), _parameters.Elements.Count));

            if (_parameters != null)
                for (int i = 0; i < Count; i++)
                    invocationScope.AddBinding(
                        _parameters.Elements[i],
                        args.ElementAt(i));

            return invocationScope;
        }