writeMethodDef method

MethodDefIndex writeMethodDef({
  1. required String name,
  2. int rva = 0,
  3. MethodImplAttributes implFlags = const MethodImplAttributes(0),
  4. MethodAttributes flags = const MethodAttributes(0),
  5. MethodSignature signature = const MethodSignature(),
})

Writes a MethodDef row, returning the corresponding index.

Implementation

MethodDefIndex writeMethodDef({
  required String name,
  int rva = 0,
  MethodImplAttributes implFlags = const MethodImplAttributes(0),
  MethodAttributes flags = const MethodAttributes(0),
  MethodSignature signature = const MethodSignature(),
}) {
  final table = _tableStream[MetadataTableId.methodDef];
  final index = MethodDefIndex(table.length);
  table.add(
    MethodDef(
      rva: rva,
      implFlags: implFlags,
      flags: flags,
      name: _stringHeap.insert(name),
      signature: _writeMethodDefSig(signature),
      paramList: ParamIndex(_tableStream[MetadataTableId.param].length),
    ),
  );
  return index;
}