Пример #1
0
        public void For(int forid, int breakid)
        {
            ForState f = (ForState)Locals[forid]._O;

            if (f == null || !f.Fetch())
            {
                NextStatement = Jumps[breakid];
            }
        }
Пример #2
0
        public IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback callback, object state)
        {
            CheckDisposed();

            if (addresses == null || addresses.Any(a => a == null))
            {
                throw new ArgumentNullException("addresses");
            }

            if (addresses.Length == 0)
            {
                throw new ArgumentException("must be at least one address in list", "addresses");
            }

            var forState = new ForState(addresses, port, callback, state);

            return(BeginConnect(new IPEndPoint(addresses[0], port), ForCallback, forState));
        }
Пример #3
0
        internal void ForEach(LocalBuilder local, Type elementType, Type enumeratorType,
            LocalBuilder enumerator, MethodInfo getCurrentMethod)
        {
            ForState forState = new ForState(local, DefineLabel(), DefineLabel(), enumerator);

            Br(forState.TestLabel);
            MarkLabel(forState.BeginLabel);

            Call(enumerator, getCurrentMethod);

            ConvertValue(elementType, GetVariableType(local));
            Stloc(local);
            blockStack.Push(forState);
        }
Пример #4
0
 internal object For(LocalBuilder local, object start, object end) {
     ForState forState = new ForState(local, DefineLabel(), DefineLabel(), end);
     if (forState.Index != null) {
         Load(start);
         Stloc(forState.Index);
         Br(forState.TestLabel);
     }
     MarkLabel(forState.BeginLabel);
     blockStack.Push(forState);
     return forState;
 }
Пример #5
0
        /// <summary>
        /// ForEach
        /// </summary>
        /// <param name="local"></param>
        /// <param name="elementType"></param>
        /// <param name="enumeratorType"></param>
        /// <param name="enumerator"></param>
        /// <param name="getCurrentMethod"></param>
        public void ForEach(LocalBuilder local, Type elementType, Type enumeratorType, LocalBuilder enumerator, MethodInfo getCurrentMethod)
        {
            Check.Require(local, "local");
            Check.Require(elementType, "elementType");
            Check.Require(enumeratorType, "enumeratorType");
            Check.Require(enumerator, "enumerator");
            Check.Require(getCurrentMethod, "getCurrentMethod");

            ForState state = new ForState(local, this.DefineLabel(), this.DefineLabel(), enumerator);
            this.Br(state.TestLabel);
            this.MarkLabel(state.BeginLabel);
            if (enumeratorType == getCurrentMethod.DeclaringType)
            {
                this.LoadThis(enumerator, getCurrentMethod);
                this.ilGen.Emit(OpCodes.Call, getCurrentMethod);
            }
            else
            {
                this.Call(enumerator, getCurrentMethod);
            }
            this.ConvertValue(elementType, this.GetVariableType(local));
            this.Stloc(local);
            this.blockStack.Push(state);
        }
Пример #6
0
        /// <summary>
        /// For
        /// </summary>
        /// <param name="local"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        public object For(LocalBuilder local, object start, object end)
        {
            Check.Require(local, "local");

            ForState state = new ForState(local, this.DefineLabel(), this.DefineLabel(), end);
            if (state.Index != null)
            {
                this.Load(start);
                this.Stloc(state.Index);
                this.Br(state.TestLabel);
            }
            this.MarkLabel(state.BeginLabel);
            this.blockStack.Push(state);
            return state;
        }
 internal void ForEach(LocalBuilder local, Type elementType, Type enumeratorType, LocalBuilder enumerator, MethodInfo getCurrentMethod)
 {
     ForState state = new ForState(local, this.DefineLabel(), this.DefineLabel(), enumerator);
     this.Br(state.TestLabel);
     this.MarkLabel(state.BeginLabel);
     this.Call(enumerator, getCurrentMethod);
     this.ConvertValue(elementType, this.GetVariableType(local));
     this.Stloc(local);
     this.blockStack.Push(state);
 }