EmitLdcI4() abstract private method

abstract private EmitLdcI4 ( FluentEmitter method ) : FluentEmitter
method FluentEmitter
return FluentEmitter
Exemplo n.º 1
0
        public FluentEmitter Starg(MagicNumberArgument value, params string[] names)
        {
            if (names == null)
            {
                throw new ArgumentNullException(nameof(names));
            }

            var count = names.Length;

            var paramgroups = names
                              .Select(GetParameter)
                              .GroupBy(p => p.ParameterType.GetILType())
                              .OrderBy(pgroup => pgroup.Sum(p => p.Index));

            foreach (var paramgroup in paramgroups)
            {
                var isfirst = true;
                foreach (var param in paramgroup.OrderBy(p => p.Index))
                {
                    if (isfirst)
                    {
                        switch (param.ParameterType.GetILType())
                        {
                        case ILType.I4: value.EmitLdcI4(this); break;

                        case ILType.I8: value.EmitLdcI8(this); break;

                        case ILType.R8: value.EmitLdcR8(this); break;

                        case ILType.R4: value.EmitLdcR4(this); break;

                        default:
                            throw new NotSupportedException(
                                      "variable type must be primitive valuetype in system namespace and convertible to I4, I8, R4 or R8");
                        }
                        isfirst = false;
                    }
                    else
                    {
                        Dup();
                    }
                }
                foreach (var param in paramgroup)
                {
                    Starg((uint)param.Index);
                }
            }

            return(this);
        }
Exemplo n.º 2
0
		public FluentEmitter Ret(MagicNumberArgument value)
		{
		    // ReSharper disable once SwitchStatementMissingSomeCases
			switch (ReturnType.GetILType())
			{
				case ILType.I4: value.EmitLdcI4(this); break;
				case ILType.I8: value.EmitLdcI8(this); break;
				case ILType.R8: value.EmitLdcR8(this); break;
				case ILType.R4: value.EmitLdcR4(this); break;
				default:
					throw new NotSupportedException(
						"return type must be primitive valuetype and convertible to I4, I8, R4 or R8");
			}
			return Ret();
		}
Exemplo n.º 3
0
        public FluentEmitter Ret(MagicNumberArgument value)
        {
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (ReturnType.GetILType())
            {
            case ILType.I4: value.EmitLdcI4(this); break;

            case ILType.I8: value.EmitLdcI8(this); break;

            case ILType.R8: value.EmitLdcR8(this); break;

            case ILType.R4: value.EmitLdcR4(this); break;

            default:
                throw new NotSupportedException(
                          "return type must be primitive valuetype and convertible to I4, I8, R4 or R8");
            }
            return(Ret());
        }
Exemplo n.º 4
0
		public FluentEmitter Starg(MagicNumberArgument value, params string[] names)
		{
			if (names == null)
				throw new ArgumentNullException(nameof(names));

			var count = names.Length;

			var paramgroups = names
				.Select(GetParameter)
				.GroupBy(p => p.ParameterType.GetILType())
				.OrderBy(pgroup => pgroup.Sum(p => p.Index));

			foreach (var paramgroup in paramgroups)
			{
				var isfirst = true;
				foreach (var param in paramgroup.OrderBy(p => p.Index))
				{
					if (isfirst)
					{
						switch (param.ParameterType.GetILType())
						{
							case ILType.I4: value.EmitLdcI4(this); break;
							case ILType.I8: value.EmitLdcI8(this); break;
							case ILType.R8: value.EmitLdcR8(this); break;
							case ILType.R4: value.EmitLdcR4(this); break;
							default:
								throw new NotSupportedException(
							   "variable type must be primitive valuetype in system namespace and convertible to I4, I8, R4 or R8");
						}
						isfirst = false;
					}
					else
						Dup();
				}
				foreach (var param in paramgroup)
				{
					Starg((uint)param.Index);
				}
			}

			return this;
		}