module property

ModuleRef module

Returns the module that contains the method.

Implementation

ModuleRef get module => using((Arena arena) {
      final pdwMappingFlags = arena<DWORD>();
      final szImportName = arena<WCHAR>(MAX_STRING_SIZE).cast<Utf16>();
      final pchImportName = arena<ULONG>();
      final ptkImportDLL = arena<mdModuleRef>();

      final hr = reader.GetPinvokeMap(token, pdwMappingFlags, szImportName,
          MAX_STRING_SIZE, pchImportName, ptkImportDLL);
      if (SUCCEEDED(hr)) {
        return ModuleRef.fromToken(scope, ptkImportDLL.value);
      } else {
        throw COMException(hr);
      }
    });