本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol类的典型用法代码示例。如果您正苦于以下问题:C# SourceMemberContainerTypeSymbol类的具体用法?C# SourceMemberContainerTypeSymbol怎么用?C# SourceMemberContainerTypeSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SourceMemberContainerTypeSymbol类属于Microsoft.CodeAnalysis.CSharp.Symbols命名空间,在下文中一共展示了SourceMemberContainerTypeSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SourceConstructorSymbol
private SourceConstructorSymbol(
SourceMemberContainerTypeSymbol containingType,
Location location,
ConstructorDeclarationSyntax syntax,
MethodKind methodKind,
DiagnosticBag diagnostics) :
base(containingType, syntax.GetReference(), syntax.Body.GetReferenceOrNull(), ImmutableArray.Create(location))
{
bool modifierErrors;
var declarationModifiers = this.MakeModifiers(syntax.Modifiers, methodKind, location, diagnostics, out modifierErrors);
this.flags = MakeFlags(methodKind, declarationModifiers, returnsVoid: true, isExtensionMethod: false);
var bodyOpt = syntax.Body;
if (bodyOpt != null)
{
if (IsExtern)
{
diagnostics.Add(ErrorCode.ERR_ExternHasBody, location, this);
}
}
var info = ModifierUtils.CheckAccessibility(this.DeclarationModifiers);
if (info != null)
{
diagnostics.Add(info, location);
}
if (!modifierErrors)
{
this.CheckModifiers(methodKind, location, diagnostics);
}
}
示例2: CreatePrimaryConstructorSymbol
public static SourceConstructorSymbol CreatePrimaryConstructorSymbol(
SourceMemberContainerTypeSymbol containingType,
ParameterListSyntax syntax,
DiagnosticBag diagnostics)
{
return new SourceConstructorSymbol(containingType, syntax.GetLocation(), syntax, diagnostics);
}
示例3: SynthesizedInteractiveInitializerMethod
internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, DiagnosticBag diagnostics)
{
Debug.Assert(containingType.IsScriptClass);
_containingType = containingType;
CalculateReturnType(containingType.DeclaringCompilation, diagnostics, out _resultType, out _returnType);
}
示例4: SourceMemberFieldSymbol
internal SourceMemberFieldSymbol(
SourceMemberContainerTypeSymbol containingType,
VariableDeclaratorSyntax declarator,
DeclarationModifiers modifiers,
bool modifierErrors,
DiagnosticBag diagnostics)
: base(containingType, declarator.Identifier.ValueText, declarator.GetReference(), declarator.Identifier.GetLocation())
{
this.modifiers = modifiers;
this.CheckAccessibility(diagnostics);
var location = Location;
if (modifierErrors)
{
// skip the following checks
}
else if (containingType.IsSealed && (DeclaredAccessibility == Accessibility.Protected || DeclaredAccessibility == Accessibility.ProtectedOrInternal))
{
diagnostics.Add(AccessCheck.GetProtectedMemberInSealedTypeError(containingType), location, this);
}
else if (IsVolatile && IsReadOnly)
{
diagnostics.Add(ErrorCode.ERR_VolatileAndReadonly, location, this);
}
else if (containingType.IsStatic && !IsStatic)
{
diagnostics.Add(ErrorCode.ERR_InstanceMemberInStaticClass, location, this);
}
// TODO: Consider checking presence of core type System.Runtime.CompilerServices.IsVolatile
// if there is a volatile modifier. Perhaps an appropriate error should be reported if the
// type isn’t available.
}
示例5: BindFieldInitializers
internal static ImmutableArray<BoundInitializer> BindFieldInitializers(
SourceMemberContainerTypeSymbol containingType,
MethodSymbol scriptCtor,
ImmutableArray<FieldInitializers> initializers,
DiagnosticBag diagnostics,
bool generateDebugInfo,
out ConsList<Imports> firstDebugImports)
{
if (initializers.IsEmpty)
{
firstDebugImports = null;
return ImmutableArray<BoundInitializer>.Empty;
}
CSharpCompilation compilation = containingType.DeclaringCompilation;
ArrayBuilder<BoundInitializer> boundInitializers = ArrayBuilder<BoundInitializer>.GetInstance();
if ((object)scriptCtor == null)
{
BindRegularCSharpFieldInitializers(compilation, initializers, boundInitializers, diagnostics, generateDebugInfo, out firstDebugImports);
}
else
{
BindScriptFieldInitializers(compilation, scriptCtor, initializers, boundInitializers, diagnostics, generateDebugInfo, out firstDebugImports);
}
return boundInitializers.ToImmutableAndFree();
}
示例6: SourceEnumConstantSymbol
protected SourceEnumConstantSymbol(SourceMemberContainerTypeSymbol containingEnum, EnumMemberDeclarationSyntax syntax, DiagnosticBag diagnostics)
: base(containingEnum, syntax.Identifier.ValueText, syntax.GetReference(), syntax.Identifier.GetLocation())
{
if (this.Name == WellKnownMemberNames.EnumBackingFieldName)
{
diagnostics.Add(ErrorCode.ERR_ReservedEnumerator, this.Location, WellKnownMemberNames.EnumBackingFieldName);
}
}
示例7: CreateConstructorSymbol
public static SourceConstructorSymbol CreateConstructorSymbol(
SourceMemberContainerTypeSymbol containingType,
ConstructorDeclarationSyntax syntax,
DiagnosticBag diagnostics)
{
var methodKind = syntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? MethodKind.StaticConstructor : MethodKind.Constructor;
return new SourceConstructorSymbol(containingType, syntax.Identifier.GetLocation(), syntax, methodKind, diagnostics);
}
示例8: CreateExplicitValuedConstant
public static SourceEnumConstantSymbol CreateExplicitValuedConstant(
SourceMemberContainerTypeSymbol containingEnum,
EnumMemberDeclarationSyntax syntax,
DiagnosticBag diagnostics)
{
var initializer = syntax.EqualsValue;
Debug.Assert(initializer != null);
return new ExplicitValuedEnumConstantSymbol(containingEnum, syntax, initializer, diagnostics);
}
示例9: SourceMemberFieldSymbol
internal SourceMemberFieldSymbol(
SourceMemberContainerTypeSymbol containingType,
DeclarationModifiers modifiers,
string name,
SyntaxReference syntax,
Location location)
: base(containingType, name, syntax, location)
{
_modifiers = modifiers;
}
示例10: SourceDelegateMethodSymbol
protected SourceDelegateMethodSymbol(
SourceMemberContainerTypeSymbol delegateType,
TypeSymbol returnType,
DelegateDeclarationSyntax syntax,
MethodKind methodKind,
DeclarationModifiers declarationModifiers)
: base(delegateType, syntax.GetReference(), bodySyntaxReferenceOpt: null, location: syntax.Identifier.GetLocation())
{
_returnType = returnType;
this.MakeFlags(methodKind, declarationModifiers, _returnType.SpecialType == SpecialType.System_Void, isExtensionMethod: false);
}
示例11: SourceFieldSymbol
protected SourceFieldSymbol(SourceMemberContainerTypeSymbol containingType, string name, SyntaxReference syntax, Location location)
{
Debug.Assert((object)containingType != null);
Debug.Assert(name != null);
Debug.Assert(syntax != null);
Debug.Assert(location != null);
this.containingType = containingType;
this.name = name;
this.syntaxReference = syntax;
this.location = location;
}
示例12: CreateUserDefinedOperatorSymbol
public static SourceUserDefinedOperatorSymbol CreateUserDefinedOperatorSymbol(
SourceMemberContainerTypeSymbol containingType,
OperatorDeclarationSyntax syntax,
DiagnosticBag diagnostics)
{
var location = syntax.OperatorToken.GetLocation();
string name = OperatorFacts.OperatorNameFromDeclaration(syntax);
return new SourceUserDefinedOperatorSymbol(
containingType, name, location, syntax, diagnostics);
}
示例13: GlobalExpressionVariable
internal GlobalExpressionVariable(
SourceMemberContainerTypeSymbol containingType,
DeclarationModifiers modifiers,
TypeSyntax typeSyntax,
string name,
SyntaxReference syntax,
Location location)
: base(containingType, modifiers, name, syntax, location)
{
Debug.Assert(DeclaredAccessibility == Accessibility.Private);
_typeSyntax = typeSyntax.GetReference();
}
示例14: SourceFixedFieldSymbol
internal SourceFixedFieldSymbol(
SourceMemberContainerTypeSymbol containingType,
VariableDeclaratorSyntax declarator,
DeclarationModifiers modifiers,
bool modifierErrors,
DiagnosticBag diagnostics)
: base(containingType, declarator, modifiers, modifierErrors, diagnostics)
{
// Checked in parser: a fixed field declaration requires a length in square brackets
Debug.Assert(this.IsFixed);
}
示例15: SynthesizedInteractiveInitializerMethod
internal SynthesizedInteractiveInitializerMethod(SourceMemberContainerTypeSymbol containingType, DiagnosticBag diagnostics)
{
Debug.Assert(containingType.IsScriptClass);
_containingType = containingType;
var compilation = containingType.DeclaringCompilation;
var submissionReturnType = compilation.SubmissionReturnType;
_resultType = (submissionReturnType == null) ?
null :
compilation.GetTypeByReflectionType(submissionReturnType, diagnostics);
}