PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Instruction­Writer Class

InstructionWriter Class

Writes a linear stream of instructions into an InstructionSequence.
Inheritance Hierarchy
System.Object
  PostSharp.Sdk.CodeModel.BaseInstructionWriter
    PostSharp.Sdk.CodeModel.InstructionWriter

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.10.10.0 (6.10.10.0)
Syntax
C#
public sealed class InstructionWriter : BaseInstructionWriter, 
	IDisposable

The InstructionWriter type exposes the following members.

Properties
  NameDescription
Public propertyCheckEnabled
Determines whether operand types should be checked at runtime.
Public propertyCurrentInstructionSequence
Gets the current instruction sequence.
Public propertyMethodBody
Gets or sets the method body assigned to the current BaseInstructionWriter.
(Inherited from BaseInstructionWriter.)
Methods
  NameDescription
Public methodAttachInstructionSequence
Attaches the current InstructionWriter to an InstructionSequence.
Public methodDetachInstructionSequence()
Detaches the current InstructionWriter from the active InstructionSequence and commits the changes.
Public methodDetachInstructionSequence(Boolean)
Detaches the current InstructionWriter form the active InstructionSequence by specifying whether the changes should be committed or rolled back.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodEmitBranchingInstruction
Emits a branching instruction.
(Overrides BaseInstructionWriter.EmitBranchingInstruction(OpCodeNumber, InstructionSequence).)
Public methodEmitConvertFromObject
Emits MSIL instructions that cast an object (of type Object) to a given type, performing unboxing when needed.
Public methodEmitConvertToObject
Emits MSIL instructions that cast an object of any type to an object (eventually boxed).
Public methodEmitInstruction
Emits an instruction without operand.
(Overrides BaseInstructionWriter.EmitInstruction(OpCodeNumber).)
Public methodEmitInstructionByte
Emits an instruction with a Byte operand.
(Overrides BaseInstructionWriter.EmitInstructionByte(OpCodeNumber, Byte).)
Public methodEmitInstructionDouble
Emits an instruction with a Double operand.
(Overrides BaseInstructionWriter.EmitInstructionDouble(OpCodeNumber, Double).)
Public methodEmitInstructionField
Emits an instruction with an IField operand.
(Overrides BaseInstructionWriter.EmitInstructionField(OpCodeNumber, IField).)
Public methodEmitInstructionInt16
Emits an instruction with an Int16 operand.
(Overrides BaseInstructionWriter.EmitInstructionInt16(OpCodeNumber, Int16).)
Public methodEmitInstructionInt32
Emits an instruction with an Int32 operand.
(Overrides BaseInstructionWriter.EmitInstructionInt32(OpCodeNumber, Int32).)
Public methodEmitInstructionInt64
Emits an instruction with an Int64 operand.
(Overrides BaseInstructionWriter.EmitInstructionInt64(OpCodeNumber, Int64).)
Public methodEmitInstructionLoadIndirect
Emits the proper "load indirect" instruction as a function of the operand type.
(Inherited from BaseInstructionWriter.)
Public methodEmitInstructionLocalVariable
Emits an instruction with a LocalVariableSymbol operand.
(Overrides BaseInstructionWriter.EmitInstructionLocalVariable(OpCodeNumber, LocalVariableSymbol).)
Public methodEmitInstructionMethod
Emits an instruction with an IMethod operand.
(Overrides BaseInstructionWriter.EmitInstructionMethod(OpCodeNumber, IMethod).)
Public methodEmitInstructionParameter
Emits an instruction with a ParameterDeclaration operand.
(Overrides BaseInstructionWriter.EmitInstructionParameter(OpCodeNumber, ParameterDeclaration).)
Public methodEmitInstructionSignature
Emits an instruction with a StandaloneSignatureDeclaration operand.
(Overrides BaseInstructionWriter.EmitInstructionSignature(OpCodeNumber, StandaloneSignatureDeclaration).)
Public methodEmitInstructionSingle
Emits an instruction with a Single operand.
(Overrides BaseInstructionWriter.EmitInstructionSingle(OpCodeNumber, Single).)
Public methodEmitInstructionStoreElement
Emits the proper instruction that stores an array element for a given ITypeSignature.
(Inherited from BaseInstructionWriter.)
Public methodEmitInstructionStoreIndirect
Emits the proper "store indirect" instruction as a function of the operand type.
(Inherited from BaseInstructionWriter.)
Public methodEmitInstructionString
Emits an instruction with a string operand.
(Overrides BaseInstructionWriter.EmitInstructionString(OpCodeNumber, LiteralString).)
Public methodEmitInstructionType
Emits an instruction with an IType operand.
(Overrides BaseInstructionWriter.EmitInstructionType(OpCodeNumber, ITypeSignature).)
Public methodEmitNopIfNecessary
Emits a Nop if necessary, i.e. there is a SymbolSequencePoint just before the current point.
Public methodEmitPrefix
Emits a prefix without operand.
(Overrides BaseInstructionWriter.EmitPrefix(InstructionPrefixes).)
Public methodEmitPrefixType
Emits a prefix with an IType operand.
(Overrides BaseInstructionWriter.EmitPrefixType(OpCodeNumber, ITypeSignature).)
Public methodEmitSwitchInstruction
Emits a Switch instruction.
(Overrides BaseInstructionWriter.EmitSwitchInstruction(InstructionSequence[]).)
Public methodEmitSymbolAsyncResumePoint
Emits a symbol to represent a resume point in the async method.
(Overrides BaseInstructionWriter.EmitSymbolAsyncResumePoint().)
Public methodEmitSymbolAsyncYieldPoint
Emits a symbol to represent a yield point in the async method.
(Overrides BaseInstructionWriter.EmitSymbolAsyncYieldPoint().)
Public methodEmitSymbolSequencePoint
Emits a symbol sequence point.
(Overrides BaseInstructionWriter.EmitSymbolSequencePoint(SymbolSequencePoint).)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberGetInstance
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Extension Methods
  NameDescription
Public Extension MethodEmitAssemblyOf (Defined by InstructionWriterExtensions.)
Public Extension MethodEmitTypeOf (Defined by InstructionWriterExtensions.)
Public Extension MethodEmitWriteLine
Emits instructions that write a line using WriteLine(String).
(Defined by InstructionWriterExtensions.)
Remarks
After having been instantiated, the InstructionWriter should be associated to an InstructionSequence using the AttachInstructionSequence(InstructionSequence). After all instructions have been written, the DetachInstructionSequence() method should be called.
See Also