本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax类的典型用法代码示例。如果您正苦于以下问题:C# ArrowExpressionClauseSyntax类的具体用法?C# ArrowExpressionClauseSyntax怎么用?C# ArrowExpressionClauseSyntax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArrowExpressionClauseSyntax类属于Microsoft.CodeAnalysis.CSharp.Syntax命名空间,在下文中一共展示了ArrowExpressionClauseSyntax类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAccessorSymbol
public static SourcePropertyAccessorSymbol CreateAccessorSymbol(
NamedTypeSymbol containingType,
SourcePropertySymbol property,
DeclarationModifiers propertyModifiers,
string propertyName,
ArrowExpressionClauseSyntax syntax,
PropertySymbol explicitlyImplementedPropertyOpt,
string aliasQualifierOpt,
DiagnosticBag diagnostics)
{
string name;
ImmutableArray<MethodSymbol> explicitInterfaceImplementations;
GetNameAndExplicitInterfaceImplementations(
explicitlyImplementedPropertyOpt,
propertyName,
property.IsCompilationOutputWinMdObj(),
aliasQualifierOpt,
isGetMethod: true,
name: out name,
explicitInterfaceImplementations:
out explicitInterfaceImplementations);
return new SourcePropertyAccessorSymbol(
containingType,
name,
property,
propertyModifiers,
explicitInterfaceImplementations,
syntax.Expression.GetLocation(),
syntax,
diagnostics);
}
示例2: IsInExpressionBody
internal static bool IsInExpressionBody(
int position,
ArrowExpressionClauseSyntax expressionBodyOpt,
SyntaxToken semicolonToken)
{
return expressionBodyOpt != null
&& IsBeforeToken(position, expressionBodyOpt, semicolonToken);
}
示例3: CreateSpeculative
/// <summary>
/// Creates a speculative SemanticModel for an expression body that did not appear in the original source code.
/// </summary>
internal static MethodBodySemanticModel CreateSpeculative(SyntaxTreeSemanticModel parentSemanticModel, MethodSymbol owner, ArrowExpressionClauseSyntax syntax, Binder rootBinder, int position)
{
Debug.Assert(parentSemanticModel != null);
Debug.Assert(syntax != null);
Debug.Assert(rootBinder != null);
Debug.Assert(rootBinder.IsSemanticModelBinder);
return new MethodBodySemanticModel(parentSemanticModel.Compilation, owner, rootBinder, syntax, parentSemanticModel, position);
}
示例4: VisitArrowExpressionClause
public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
{
if (!this.InsideFluentOrInitializerExample) return;
var syntaxNode = node?.ChildNodes()?.LastOrDefault()?.WithAdditionalAnnotations();
if (syntaxNode == null) return;
var line = node.SyntaxTree.GetLineSpan(node.Span).StartLinePosition.Line;
var walker = new CodeWithDocumentationWalker(ClassDepth, line);
walker.Visit(syntaxNode);
this.Blocks.AddRange(walker.Blocks);
}
示例5: PropertyDeclaration
public static PropertyDeclarationSyntax PropertyDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax accessorList, ArrowExpressionClauseSyntax expressionBody, EqualsValueClauseSyntax initializer, SyntaxToken semicolonToken)
{
return PropertyDeclaration(
attributeLists,
modifiers,
refKeyword: default(SyntaxToken),
type: type,
explicitInterfaceSpecifier: explicitInterfaceSpecifier,
identifier: identifier,
accessorList: accessorList,
expressionBody: expressionBody,
initializer: initializer,
semicolonToken: semicolonToken);
}
示例6: DestructorDeclaration
public static DestructorDeclarationSyntax DestructorDeclaration(
SyntaxList<AttributeListSyntax> attributeLists,
SyntaxTokenList modifiers,
SyntaxToken identifier,
ParameterListSyntax parameterList,
ArrowExpressionClauseSyntax expressionBody)
=> DestructorDeclaration(
attributeLists,
modifiers,
SyntaxFactory.Token(SyntaxKind.TildeToken),
identifier,
parameterList,
default(BlockSyntax),
expressionBody,
default(SyntaxToken));
示例7: ConstructorDeclaration
public static ConstructorDeclarationSyntax ConstructorDeclaration(
SyntaxList<AttributeListSyntax> attributeLists,
SyntaxTokenList modifiers,
SyntaxToken identifier,
ParameterListSyntax parameterList,
ConstructorInitializerSyntax initializer,
ArrowExpressionClauseSyntax expressionBody)
=> ConstructorDeclaration(
attributeLists,
modifiers,
identifier,
parameterList,
initializer,
default(BlockSyntax),
expressionBody,
default(SyntaxToken));
示例8: MethodDeclaration
public static MethodDeclarationSyntax MethodDeclaration(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax body, ArrowExpressionClauseSyntax expressionBody, SyntaxToken semicolonToken)
{
return SyntaxFactory.MethodDeclaration(
attributeLists,
modifiers,
default(SyntaxToken),
returnType,
explicitInterfaceSpecifier,
identifier,
typeParameterList,
parameterList,
constraintClauses,
body,
expressionBody,
semicolonToken);
}
示例9: IndexerDeclaration
public static IndexerDeclarationSyntax IndexerDeclaration(
SyntaxList<AttributeListSyntax> attributeLists,
SyntaxTokenList modifiers,
TypeSyntax type,
ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifier,
SyntaxToken thisKeyword,
BracketedParameterListSyntax parameterList,
AccessorListSyntax accessorList,
ArrowExpressionClauseSyntax expressionBody,
SyntaxToken semicolonToken)
{
return SyntaxFactory.IndexerDeclaration(
attributeLists: attributeLists,
modifiers: modifiers,
refKeyword: default(SyntaxToken),
type: type,
explicitInterfaceSpecifier: explicitInterfaceSpecifier,
thisKeyword: thisKeyword,
parameterList: parameterList,
accessorList: accessorList,
expressionBody: expressionBody,
semicolonToken: semicolonToken);
}
示例10: VisitArrowExpressionClause
/// <summary>
/// Called when the visitor visits a ArrowExpressionClauseSyntax node.
/// </summary>
public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
{
var accessor = SyntaxFactory.ReturnStatement(node.Expression);
_members.Add(accessor);
}
示例11: SourcePropertyAccessorSymbol
private SourcePropertyAccessorSymbol(
NamedTypeSymbol containingType,
string name,
SourcePropertySymbol property,
DeclarationModifiers propertyModifiers,
ImmutableArray<MethodSymbol> explicitInterfaceImplementations,
Location location,
ArrowExpressionClauseSyntax syntax,
DiagnosticBag diagnostics) :
base(containingType, syntax.GetReference(), syntax.GetReference(), location)
{
_property = property;
_explicitInterfaceImplementations = explicitInterfaceImplementations;
_name = name;
_isAutoPropertyAccessor = false;
// The modifiers for the accessor are the same as the modifiers for the property,
// minus the indexer bit
var declarationModifiers = propertyModifiers & ~DeclarationModifiers.Indexer;
// ReturnsVoid property is overridden in this class so
// returnsVoid argument to MakeFlags is ignored.
this.MakeFlags(MethodKind.PropertyGet, declarationModifiers, returnsVoid: false, isExtensionMethod: false,
isMetadataVirtualIgnoringModifiers: explicitInterfaceImplementations.Any());
CheckModifiersForBody(location, diagnostics);
var info = ModifierUtils.CheckAccessibility(this.DeclarationModifiers);
if (info != null)
{
diagnostics.Add(info, location);
}
this.CheckModifiers(location, isAutoPropertyOrExpressionBodied: true, diagnostics: diagnostics);
if (this.IsOverride)
{
MethodSymbol overriddenMethod = this.OverriddenMethod;
if ((object)overriddenMethod != null)
{
// If this accessor is overriding a method from metadata, it is possible that
// the name of the overridden method doesn't follow the C# get_X/set_X pattern.
// We should copy the name so that the runtime will recognize this as an override.
_name = overriddenMethod.Name;
}
}
}
示例12: VisitArrowExpressionClause
public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
{
var arrowBinder = new ExpressionVariableBinder(node, _enclosing);
AddToMap(node, arrowBinder);
Visit(node.Expression, arrowBinder);
}
示例13: GetDeclaredSymbol
public override IMethodSymbol GetDeclaredSymbol(ArrowExpressionClauseSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
{
// Can't define another member inside member.
return null;
}
示例14: TryGetEffectiveGetterBody
public static SyntaxNode TryGetEffectiveGetterBody(ArrowExpressionClauseSyntax propertyBody, AccessorListSyntax accessorList)
{
if (propertyBody != null)
{
return propertyBody.Expression;
}
return accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault()?.Body;
}
示例15: TryGetSpeculativeSemanticModelCore
internal override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSemanticModel parentModel, int position, ArrowExpressionClauseSyntax expressionBody, out SemanticModel speculativeModel)
{
position = CheckAndAdjustPosition(position);
var model = this.GetMemberModel(position);
if (model != null)
{
return model.TryGetSpeculativeSemanticModelCore(parentModel, position, expressionBody, out speculativeModel);
}
speculativeModel = null;
return false;
}