コード例 #1
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, byte value)
		{
			if (opcode.OperandType == OperandType.ShortInlineVar)
				return Instruction.Create (opcode, body.Variables [value]);

			if (opcode.OperandType == OperandType.ShortInlineArg)
				return Instruction.Create (opcode, body.GetParameter (value));

			return Instruction.Create (opcode, value);
		}
コード例 #2
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, FieldReference field)
		{
			Append (Create (opcode, field));
		}
コード例 #3
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		internal Instruction (OpCode opcode, object operand)
		{
			this.opcode = opcode;
			this.operand = operand;
		}
コード例 #4
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, ParameterDefinition parameter)
		{
			if (parameter == null)
				throw new ArgumentNullException ("parameter");
			if (opcode.OperandType != OperandType.ShortInlineArg &&
				opcode.OperandType != OperandType.InlineArg)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, parameter);
		}
コード例 #5
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, Instruction [] targets)
		{
			if (targets == null)
				throw new ArgumentNullException ("targets");
			if (opcode.OperandType != OperandType.InlineSwitch)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, targets);
		}
コード例 #6
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, double value)
		{
			if (opcode.OperandType != OperandType.InlineR)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, value);
		}
コード例 #7
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, string value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			if (opcode.OperandType != OperandType.InlineString)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, value);
		}
コード例 #8
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, MethodReference method)
		{
			if (method == null)
				throw new ArgumentNullException ("method");
			if (opcode.OperandType != OperandType.InlineMethod &&
				opcode.OperandType != OperandType.InlineTok)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, method);
		}
コード例 #9
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode)
		{
			return Instruction.Create (opcode);
		}
コード例 #10
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, ParameterDefinition parameter)
		{
			Append (Create (opcode, parameter));
		}
コード例 #11
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, VariableDefinition variable)
		{
			Append (Create (opcode, variable));
		}
コード例 #12
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, Instruction [] targets)
		{
			Append (Create (opcode, targets));
		}
コード例 #13
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, double value)
		{
			Append (Create (opcode, value));
		}
コード例 #14
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, float value)
		{
			Append (Create (opcode, value));
		}
コード例 #15
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, long value)
		{
			Append (Create (opcode, value));
		}
コード例 #16
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, TypeReference type)
		{
			if (type == null)
				throw new ArgumentNullException ("type");
			if (opcode.OperandType != OperandType.InlineType &&
				opcode.OperandType != OperandType.InlineTok)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, type);
		}
コード例 #17
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, CallSite site)
		{
			if (site == null)
				throw new ArgumentNullException ("site");
			if (opcode.Code != Code.Calli)
				throw new ArgumentException ("code");

			return new Instruction (opcode, site);
		}
コード例 #18
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, TypeReference type)
		{
			return Instruction.Create (opcode, type);
		}
コード例 #19
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, FieldReference field)
		{
			if (field == null)
				throw new ArgumentNullException ("field");
			if (opcode.OperandType != OperandType.InlineField &&
				opcode.OperandType != OperandType.InlineTok)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, field);
		}
コード例 #20
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, CallSite site)
		{
			return Instruction.Create (opcode, site);
		}
コード例 #21
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, byte value)
		{
			if (opcode.OperandType != OperandType.ShortInlineI ||
				opcode == OpCodes.Ldc_I4_S)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, value);
		}
コード例 #22
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, MethodReference method)
		{
			return Instruction.Create (opcode, method);
		}
コード例 #23
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, Instruction target)
		{
			if (target == null)
				throw new ArgumentNullException ("target");
			if (opcode.OperandType != OperandType.InlineBrTarget &&
				opcode.OperandType != OperandType.ShortInlineBrTarget)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, target);
		}
コード例 #24
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, FieldReference field)
		{
			return Instruction.Create (opcode, field);
		}
コード例 #25
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode, VariableDefinition variable)
		{
			if (variable == null)
				throw new ArgumentNullException ("variable");
			if (opcode.OperandType != OperandType.ShortInlineVar &&
				opcode.OperandType != OperandType.InlineVar)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, variable);
		}
コード例 #26
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public Instruction Create (OpCode opcode, sbyte value)
		{
			return Instruction.Create (opcode, value);
		}
コード例 #27
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		internal Instruction (int offset, OpCode opCode)
		{
			this.offset = offset;
			this.opcode = opCode;
		}
コード例 #28
0
ファイル: Instruction.cs プロジェクト: fugaku/scriptsharp
		public static Instruction Create (OpCode opcode)
		{
			if (opcode.OperandType != OperandType.InlineNone)
				throw new ArgumentException ("opcode");

			return new Instruction (opcode, null);
		}
コード例 #29
0
ファイル: CodeWriter.cs プロジェクト: fugaku/scriptsharp
		void WriteOpCode (OpCode opcode)
		{
			if (opcode.Size == 1) {
				WriteByte (opcode.Op2);
			} else {
				WriteByte (opcode.Op1);
				WriteByte (opcode.Op2);
			}
		}
コード例 #30
0
ファイル: ILProcessor.cs プロジェクト: fugaku/scriptsharp
		public void Emit (OpCode opcode, CallSite site)
		{
			Append (Create (opcode, site));
		}