Mono.CSharp.LocalTemporary.Store C# (CSharp) Method

Store() public method

public Store ( EmitContext ec ) : void
ec EmitContext
return void
		public void Store (EmitContext ec)
		{
			if (builder == null)
				builder = ec.GetTemporaryLocal (type);

			ec.Emit (OpCodes.Stloc, builder);
		}

Usage Example

Example #1
0
        //
        // if `dup_args' is true or any of arguments contains await.
        // A copy of all arguments will be returned to the caller
        //
        public virtual Arguments Emit(EmitContext ec, bool dup_args, bool prepareAwait)
        {
            List <Argument> dups;

            if ((dup_args && Count != 0) || prepareAwait)
            {
                dups = new List <Argument> (Count);
            }
            else
            {
                dups = null;
            }

            LocalTemporary lt;

            foreach (Argument a in args)
            {
                if (prepareAwait)
                {
                    dups.Add(a.EmitToField(ec, true));
                    continue;
                }

                a.Emit(ec);

                if (!dup_args)
                {
                    continue;
                }

                if (a.Expr.IsSideEffectFree)
                {
                    //
                    // No need to create a temporary variable for side effect free expressions. I assume
                    // all side-effect free expressions are cheap, this has to be tweaked when we become
                    // more aggressive on detection
                    //
                    dups.Add(a);
                }
                else
                {
                    ec.Emit(OpCodes.Dup);

                    // TODO: Release local temporary on next Emit
                    // Need to add a flag to argument to indicate this
                    lt = new LocalTemporary(a.Type);
                    lt.Store(ec);

                    dups.Add(new Argument(lt, a.ArgType));
                }
            }

            if (dups != null)
            {
                return(new Arguments(dups));
            }

            return(null);
        }
All Usage Examples Of Mono.CSharp.LocalTemporary::Store