/// <summary> /// Creates a method semantics object from a method semantics row. /// </summary> /// <param name="parentModule"></param> /// <param name="token">The token to initialize the semantics for.</param> /// <param name="row">The metadata table row to base the semantics on.</param> public SerializedMethodSemantics(SerializedModuleDefinition parentModule, MetadataToken token, MethodSemanticsRow row) : base(token) { _parentModule = parentModule ?? throw new ArgumentNullException(nameof(parentModule)); _row = row; Attributes = row.Attributes; }
public int Compare(object x, object y) { MethodSemanticsRow a = x as MethodSemanticsRow; MethodSemanticsRow b = y as MethodSemanticsRow; return(Comparer.Default.Compare( Utilities.CompressMetadataToken(CodedIndex.HasSemantics, a.Association), Utilities.CompressMetadataToken(CodedIndex.HasSemantics, b.Association))); }
public override void FromRawData(byte [] buff, int offs, int numRows) { for (int i = numRows; --i >= 0;) { Row row = new MethodSemanticsRow(this); row.FromRawData(buff, offs); Add(row); offs += MethodSemanticsRow.LogicalSize; } }
/// <summary> /// Reads the specified token. /// </summary> /// <param name="token">The token.</param> /// <param name="result">The result.</param> public void Read(TokenTypes token, out MethodSemanticsRow result) { using (BinaryReader reader = CreateReaderForToken(token)) { if ((token & TokenTypes.TableMask) != TokenTypes.MethodSemantics) { throw new ArgumentException("Invalid token type for MethodSemanticsRow.", "token"); } result = new MethodSemanticsRow((MethodSemanticsAttributes)reader.ReadInt16(), ReadIndexValue(reader, TokenTypes.MethodDef), ReadIndexValue(reader, IndexType.HasSemantics)); } }
private void AddMethodSemantics(MetadataToken ownerToken, MethodSemantics semantics) { var table = Metadata.TablesStream.GetSortedTable <MethodSemantics, MethodSemanticsRow>(TableIndex.MethodSemantics); var encoder = Metadata.TablesStream.GetIndexEncoder(CodedIndex.HasSemantics); var row = new MethodSemanticsRow( semantics.Attributes, GetMethodDefinitionToken(semantics.Method).Rid, encoder.EncodeToken(ownerToken) ); table.Add(semantics, row); }
void ReadSemantics() { if (!m_tHeap.HasTable(MethodSemanticsTable.RId)) { return; } MethodSemanticsTable semTable = m_tableReader.GetMethodSemanticsTable(); for (int i = 0; i < semTable.Rows.Count; i++) { MethodSemanticsRow semRow = semTable [i]; MethodDefinition semMeth = GetMethodDefAt(semRow.Method); semMeth.SemanticsAttributes = semRow.Semantics; switch (semRow.Association.TokenType) { case TokenType.Event: EventDefinition evt = GetEventDefAt(semRow.Association.RID); if ((semRow.Semantics & MethodSemanticsAttributes.AddOn) != 0) { evt.AddMethod = semMeth; } else if ((semRow.Semantics & MethodSemanticsAttributes.Fire) != 0) { evt.InvokeMethod = semMeth; } else if ((semRow.Semantics & MethodSemanticsAttributes.RemoveOn) != 0) { evt.RemoveMethod = semMeth; } break; case TokenType.Property: PropertyDefinition prop = GetPropertyDefAt(semRow.Association.RID); if ((semRow.Semantics & MethodSemanticsAttributes.Getter) != 0) { prop.GetMethod = semMeth; } else if ((semRow.Semantics & MethodSemanticsAttributes.Setter) != 0) { prop.SetMethod = semMeth; } break; } } }
public virtual void VisitMethodSemanticsRow(MethodSemanticsRow row) { }
void IMetadataProvider.Read(TokenTypes token, out MethodSemanticsRow result) { TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables]; theap.Read(token, out result); }
public virtual void VisitMethodSemanticsRow(MethodSemanticsRow row) { }