本文整理汇总了C#中Symbol.IsPartialMethod方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.IsPartialMethod方法的具体用法?C# Symbol.IsPartialMethod怎么用?C# Symbol.IsPartialMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.IsPartialMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static SourceParameterSymbol Create(
Binder context,
Symbol owner,
TypeSymbol parameterType,
ParameterSyntax syntax,
RefKind refKind,
SyntaxToken identifier,
int ordinal,
bool isParams,
bool isExtensionMethodThis,
DiagnosticBag diagnostics)
{
var name = identifier.ValueText;
var locations = ImmutableArray.Create<Location>(new SourceLocation(identifier));
if (!isParams &&
!isExtensionMethodThis &&
(syntax.Default == null) &&
(syntax.AttributeLists.Count == 0) &&
!owner.IsPartialMethod())
{
return new SourceSimpleParameterSymbol(owner, parameterType, ordinal, refKind, name, locations);
}
if (isParams)
{
// touch the constructor in order to generate proper use-site diagnostics
Binder.ReportUseSiteDiagnosticForSynthesizedAttribute(context.Compilation,
WellKnownMember.System_ParamArrayAttribute__ctor,
diagnostics,
identifier.Parent.GetLocation());
}
var syntaxRef = syntax.GetReference();
return new SourceComplexParameterSymbol(
owner,
ordinal,
parameterType,
refKind,
ImmutableArray<CustomModifier>.Empty,
false,
name,
locations,
syntaxRef,
ConstantValue.Unset,
isParams,
isExtensionMethodThis);
}
示例2: CheckOverrideMember
//.........这里部分代码省略.........
{
diagnostics.Add(ErrorCode.ERR_AmbigOverride, overridingMemberLocation,
overriddenMembers[0].OriginalDefinition, overriddenMembers[1].OriginalDefinition, overridingType);
suppressAccessors = true;
}
else
{
var overriddenMember = overriddenMembers[0];
//otherwise, it would have been excluded during lookup
HashSet<DiagnosticInfo> useSiteDiagnosticsNotUsed = null;
Debug.Assert(AccessCheck.IsSymbolAccessible(overriddenMember, overridingType, ref useSiteDiagnosticsNotUsed));
Debug.Assert(overriddenMember.Kind == overridingMember.Kind);
if (overriddenMember.MustCallMethodsDirectly())
{
diagnostics.Add(ErrorCode.ERR_CantOverrideBogusMethod, overridingMemberLocation, overridingMember, overriddenMember);
suppressAccessors = true;
}
else if (!overriddenMember.IsVirtual && !overriddenMember.IsAbstract && !overriddenMember.IsOverride &&
!(overridingMemberIsMethod && ((MethodSymbol)overriddenMember).MethodKind == MethodKind.Destructor)) //destructors are metadata virtual
{
// CONSIDER: To match Dev10, skip the error for properties, and don't suppressAccessors
diagnostics.Add(ErrorCode.ERR_CantOverrideNonVirtual, overridingMemberLocation, overridingMember, overriddenMember);
suppressAccessors = true;
}
else if (overriddenMember.IsSealed)
{
// CONSIDER: To match Dev10, skip the error for properties, and don't suppressAccessors
diagnostics.Add(ErrorCode.ERR_CantOverrideSealed, overridingMemberLocation, overridingMember, overriddenMember);
suppressAccessors = true;
}
else if (!overridingMember.IsPartialMethod() && !OverrideHasCorrectAccessibility(overriddenMember, overridingMember))
{
var accessibility = SyntaxFacts.GetText(overriddenMember.DeclaredAccessibility);
diagnostics.Add(ErrorCode.ERR_CantChangeAccessOnOverride, overridingMemberLocation, overridingMember, accessibility, overriddenMember);
suppressAccessors = true;
}
else
{
// As in dev11, we don't compare obsoleteness to the immediately-overridden member,
// but to the least-overridden member.
var leastOverriddenMember = overriddenMember.GetLeastOverriddenMember(overriddenMember.ContainingType);
overridingMember.ForceCompleteObsoleteAttribute();
leastOverriddenMember.ForceCompleteObsoleteAttribute();
Debug.Assert(overridingMember.ObsoleteState != ThreeState.Unknown);
Debug.Assert(leastOverriddenMember.ObsoleteState != ThreeState.Unknown);
bool overridingMemberIsObsolete = overridingMember.ObsoleteState == ThreeState.True;
bool leastOverriddenMemberIsObsolete = leastOverriddenMember.ObsoleteState == ThreeState.True;
if (overridingMemberIsObsolete != leastOverriddenMemberIsObsolete)
{
ErrorCode code = overridingMemberIsObsolete
? ErrorCode.WRN_ObsoleteOverridingNonObsolete
: ErrorCode.WRN_NonObsoleteOverridingObsolete;
diagnostics.Add(code, overridingMemberLocation, overridingMember, leastOverriddenMember);
}
else if (overridingMemberIsProperty)
{
PropertySymbol overridingProperty = (PropertySymbol)overridingMember;
PropertySymbol overriddenProperty = (PropertySymbol)overriddenMember;