本文整理汇总了C#中TypeReference.Write方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.Write方法的具体用法?C# TypeReference.Write怎么用?C# TypeReference.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeReference
的用法示例。
在下文中一共展示了TypeReference.Write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public void Write(ModuleWriter writer)
{
// Create the header.
ModuleHeader header = new ModuleHeader();
// Populate it.
// Store the module type.
header.moduleType = (uint)moduleType;
// Write the header.
header.Write(writer);
// Prepare the members.
globalNamespace.PrepareSerialization();
foreach(ScopeMember instance in genericInstances)
instance.PrepareSerialization();
// Prepare type referemnces.
PrepareTypeReferences();
// Prepare resource writing.
PrepareResources();
// Prepare debug information.
DebugEmitter debugEmitter = null;
if(debugBuild)
{
debugEmitter = new DebugEmitter(this);
debugEmitter.Prepare();
globalNamespace.PrepareDebug(debugEmitter);
}
// Don't allow registering members.
writingModule = true;
// Write the members.
header.memberTableOffset = writer.GetPosition();
foreach(ScopeMember member in memberTable)
{
// Write local members, and a pointer for the externals.
ChelaModule memberModule = member.GetModule();
if(memberModule == this)
{
member.Write(writer);
}
else
{
// Don't write external generic instances.
if(member.GetGenericInstance() != null)
throw new ModuleException("Write external generic instance.");
// Create the member reference header.
MemberHeader mheader = new MemberHeader();
mheader.memberSize = 1;
mheader.memberName = RegisterString(member.GetFullName()); // TODO: Use mangled name.
mheader.memberType = (byte)MemberHeaderType.Reference;
// Write the reference header and module id.
mheader.Write(writer);
writer.Write((byte)AddReference(memberModule));
}
}
header.memberTableSize = writer.GetPosition() - header.memberTableOffset;
// Write module references.
header.moduleRefTableOffset = writer.GetPosition();
header.moduleRefTableEntries = (uint) (referencedModules.Count + 1);
// Write myself.
ModuleReference modRef = new ModuleReference();
modRef.moduleName = RegisterString(GetName());
modRef.Write(writer);
// Write module references.
foreach(ChelaModule mod in referencedModules)
{
modRef.moduleName = RegisterString(mod.GetName());
modRef.Write(writer);
}
// Write the libraries table.
header.libTableOffset = writer.GetPosition();
header.libTableEntries = (uint)nativeLibraries.Count;
foreach(string libname in nativeLibraries)
writer.Write(RegisterString(libname));
// Write the anonymous types.
header.anonTypeTableOffset = writer.GetPosition();
WriteAnonType(writer);
header.anonTypeTableSize = writer.GetPosition() - header.anonTypeTableOffset;
// Write the type table.
header.typeTableOffset = writer.GetPosition();
header.typeTableEntries = (uint)typeTable.Count;
TypeReference typeRef = new TypeReference();
foreach(IChelaType type in typeTable)
{
// Write the type kind.
if(type.IsTypeInstance())
//.........这里部分代码省略.........