本文整理汇总了C#中Mono.CSharp.TypeDefinition.AddPartialPart方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.AddPartialPart方法的具体用法?C# TypeDefinition.AddPartialPart怎么用?C# TypeDefinition.AddPartialPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeDefinition
的用法示例。
在下文中一共展示了TypeDefinition.AddPartialPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPartial
protected void AddPartial (TypeDefinition next_part, TypeDefinition existing)
{
next_part.ModFlags |= Modifiers.PARTIAL;
if (existing == null) {
AddTypeContainer (next_part);
return;
}
if ((existing.ModFlags & Modifiers.PARTIAL) == 0) {
if (existing.Kind != next_part.Kind) {
AddTypeContainer (next_part);
} else {
Report.SymbolRelatedToPreviousError (next_part);
Error_MissingPartialModifier (existing);
}
return;
}
if (existing.Kind != next_part.Kind) {
Report.SymbolRelatedToPreviousError (existing);
Report.Error (261, next_part.Location,
"Partial declarations of `{0}' must be all classes, all structs or all interfaces",
next_part.GetSignatureForError ());
}
if ((existing.ModFlags & Modifiers.AccessibilityMask) != (next_part.ModFlags & Modifiers.AccessibilityMask) &&
((existing.ModFlags & Modifiers.DEFAULT_ACCESS_MODIFIER) == 0 &&
(next_part.ModFlags & Modifiers.DEFAULT_ACCESS_MODIFIER) == 0)) {
Report.SymbolRelatedToPreviousError (existing);
Report.Error (262, next_part.Location,
"Partial declarations of `{0}' have conflicting accessibility modifiers",
next_part.GetSignatureForError ());
}
var tc_names = existing.CurrentTypeParameters;
if (tc_names != null) {
for (int i = 0; i < tc_names.Count; ++i) {
var tp = next_part.MemberName.TypeParameters[i];
if (tc_names[i].MemberName.Name != tp.MemberName.Name) {
Report.SymbolRelatedToPreviousError (existing.Location, "");
Report.Error (264, next_part.Location, "Partial declarations of `{0}' must have the same type parameter names in the same order",
next_part.GetSignatureForError ());
break;
}
if (tc_names[i].Variance != tp.Variance) {
Report.SymbolRelatedToPreviousError (existing.Location, "");
Report.Error (1067, next_part.Location, "Partial declarations of `{0}' must have the same type parameter variance modifiers",
next_part.GetSignatureForError ());
break;
}
}
}
if ((next_part.ModFlags & Modifiers.DEFAULT_ACCESS_MODIFIER) != 0) {
existing.ModFlags |= next_part.ModFlags & ~(Modifiers.DEFAULT_ACCESS_MODIFIER | Modifiers.AccessibilityMask);
} else if ((existing.ModFlags & Modifiers.DEFAULT_ACCESS_MODIFIER) != 0) {
existing.ModFlags &= ~(Modifiers.DEFAULT_ACCESS_MODIFIER | Modifiers.AccessibilityMask);
existing.ModFlags |= next_part.ModFlags;
} else {
existing.ModFlags |= next_part.ModFlags;
}
existing.Definition.Modifiers = existing.ModFlags;
if (next_part.attributes != null) {
if (existing.attributes == null)
existing.attributes = next_part.attributes;
else
existing.attributes.AddAttributes (next_part.attributes.Attrs);
}
next_part.PartialContainer = existing;
existing.AddPartialPart (next_part);
AddTypeContainerMember (next_part);
}