Org.Mozilla.Classfile.ClassFileWriter.Add C# (CSharp) Method

Add() public method

Add the single-byte opcode to the current method.
Add the single-byte opcode to the current method.
public Add ( int theOpCode ) : void
theOpCode int the opcode of the bytecode
return void
		public virtual void Add(int theOpCode)
		{
			if (OpcodeCount(theOpCode) != 0)
			{
				throw new ArgumentException("Unexpected operands");
			}
			int newStack = itsStackTop + StackChange(theOpCode);
			if (newStack < 0 || short.MaxValue < newStack)
			{
				BadStack(newStack);
			}
			AddToCodeBuffer(theOpCode);
			itsStackTop = (short)newStack;
			if (newStack > itsMaxStack)
			{
				itsMaxStack = (short)newStack;
			}
			if (theOpCode == ByteCode.ATHROW)
			{
				AddSuperBlockStart(itsCodeBufferTop);
			}
		}

Same methods

ClassFileWriter::Add ( int theOpCode, int theOperand ) : void
ClassFileWriter::Add ( int theOpCode, int theOperand1, int theOperand2 ) : void
ClassFileWriter::Add ( int theOpCode, string className ) : void
ClassFileWriter::Add ( int theOpCode, string className, string fieldName, string fieldType ) : void

Usage Example

コード例 #1
0
ファイル: Codegen.cs プロジェクト: hazzik/Rhino.Net
		private void EmitConstantDudeInitializers(ClassFileWriter cfw)
		{
			int N = itsConstantListSize;
			if (N == 0)
			{
				return;
			}
			cfw.StartMethod("<clinit>", "()V", (short)(ClassFileWriter.ACC_STATIC | ClassFileWriter.ACC_FINAL));
			double[] array = itsConstantList;
			for (int i = 0; i != N; ++i)
			{
				double num = array[i];
				string constantName = "_k" + i;
				string constantType = GetStaticConstantWrapperType(num);
				cfw.AddField(constantName, constantType, (short)(ClassFileWriter.ACC_STATIC | ClassFileWriter.ACC_PRIVATE));
				int inum = (int)num;
				if (inum == num)
				{
					cfw.AddPush(inum);
					cfw.AddInvoke(ByteCode.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
				}
				else
				{
					cfw.AddPush(num);
					AddDoubleWrap(cfw);
				}
				cfw.Add(ByteCode.PUTSTATIC, mainClassName, constantName, constantType);
			}
			cfw.Add(ByteCode.RETURN);
			cfw.StopMethod((short)0);
		}
All Usage Examples Of Org.Mozilla.Classfile.ClassFileWriter::Add