Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
40f44bed
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
40f44bed
编写于
3月 10, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use patterns in more places.
上级
b73e9dd2
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
125 addition
and
165 deletion
+125
-165
src/Workspaces/CSharp/Portable/Classification/Classifiers/NameSyntaxClassifier.cs
...rtable/Classification/Classifiers/NameSyntaxClassifier.cs
+4
-4
src/Workspaces/CSharp/Portable/Classification/Classifiers/UsingDirectiveSyntaxClassifier.cs
...ssification/Classifiers/UsingDirectiveSyntaxClassifier.cs
+2
-2
src/Workspaces/CSharp/Portable/Classification/Worker_Preprocesser.cs
...ces/CSharp/Portable/Classification/Worker_Preprocesser.cs
+15
-18
src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs
...paces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs
+2
-2
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs
...rp/Portable/CodeGeneration/CSharpCodeGenerationService.cs
+10
-12
src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
...ces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
+2
-4
src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs
...aces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs
+5
-6
src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
...spaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
+2
-5
src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
.../CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
+24
-36
src/Workspaces/CSharp/Portable/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs
...sions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs
+2
-2
src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs
...ces/CSharp/Portable/Extensions/SemanticModelExtensions.cs
+9
-10
src/Workspaces/CSharp/Portable/Extensions/SyntaxTreeExtensions.cs
...spaces/CSharp/Portable/Extensions/SyntaxTreeExtensions.cs
+2
-4
src/Workspaces/CSharp/Portable/Formatting/Rules/ElasticTriviaFormattingRule.cs
.../Portable/Formatting/Rules/ElasticTriviaFormattingRule.cs
+8
-12
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+7
-8
src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs
...nguageServices/CSharpTypeInferenceService.TypeInferrer.cs
+6
-8
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
...p/Portable/Recommendations/CSharpRecommendationService.cs
+2
-2
src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs
...rp/Portable/Rename/CSharpRenameRewriterLanguageService.cs
+3
-4
src/Workspaces/CSharp/Portable/Simplification/AbstractCSharpReducer.AbstractExpressionRewriter.cs
...ation/AbstractCSharpReducer.AbstractExpressionRewriter.cs
+4
-4
src/Workspaces/CSharp/Portable/Simplification/CSharpEscapingReducer.cs
...s/CSharp/Portable/Simplification/CSharpEscapingReducer.cs
+4
-4
src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs
...le/Simplification/CSharpSimplificationService.Expander.cs
+4
-8
src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
...rkspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
+8
-10
未找到文件。
src/Workspaces/CSharp/Portable/Classification/Classifiers/NameSyntaxClassifier.cs
浏览文件 @
40f44bed
...
...
@@ -160,9 +160,9 @@ private static bool IsNamespaceName(NameSyntax name)
if
(
symbol
!=
null
)
{
// Use .Equals since we can't rely on object identity for constructed types.
if
(
symbol
is
ITypeSymbol
)
if
(
symbol
is
ITypeSymbol
typeSymbol
)
{
var
classification
=
GetClassificationForType
(
(
ITypeSymbol
)
s
ymbol
);
var
classification
=
GetClassificationForType
(
typeS
ymbol
);
if
(
classification
!=
null
)
{
var
token
=
name
.
GetNameToken
();
...
...
@@ -288,9 +288,9 @@ private bool TryClassifyNameOfIdentifier(NameSyntax name, SymbolInfo symbolInfo,
private
bool
IsSymbolCalledVar
(
ISymbol
symbol
)
{
if
(
symbol
is
INamedTypeSymbol
)
if
(
symbol
is
INamedTypeSymbol
namedType
)
{
return
((
INamedTypeSymbol
)
symbol
)
.
Arity
==
0
&&
symbol
.
Name
==
"var"
;
return
namedType
.
Arity
==
0
&&
symbol
.
Name
==
"var"
;
}
return
symbol
!=
null
&&
symbol
.
Name
==
"var"
;
...
...
src/Workspaces/CSharp/Portable/Classification/Classifiers/UsingDirectiveSyntaxClassifier.cs
浏览文件 @
40f44bed
...
...
@@ -16,9 +16,9 @@ internal class UsingDirectiveSyntaxClassifier : AbstractSyntaxClassifier
SemanticModel
semanticModel
,
CancellationToken
cancellationToken
)
{
if
(
syntax
is
UsingDirectiveSyntax
)
if
(
syntax
is
UsingDirectiveSyntax
usingDirective
)
{
return
ClassifyUsingDirectiveSyntax
(
(
UsingDirectiveSyntax
)
syntax
,
semanticModel
,
cancellationToken
);
return
ClassifyUsingDirectiveSyntax
(
usingDirective
,
semanticModel
,
cancellationToken
);
}
return
null
;
...
...
src/Workspaces/CSharp/Portable/Classification/Worker_Preprocesser.cs
浏览文件 @
40f44bed
...
...
@@ -108,38 +108,35 @@ private void ClassifyPreprocessorExpression(ExpressionSyntax node)
return
;
}
if
(
node
is
LiteralExpressionSyntax
)
if
(
node
is
LiteralExpressionSyntax
literal
)
{
// true or false
AddClassification
(
((
LiteralExpressionSyntax
)
node
)
.
Token
,
ClassificationTypeNames
.
Keyword
);
AddClassification
(
literal
.
Token
,
ClassificationTypeNames
.
Keyword
);
}
else
if
(
node
is
IdentifierNameSyntax
)
else
if
(
node
is
IdentifierNameSyntax
identifier
)
{
// DEBUG
AddClassification
(
((
IdentifierNameSyntax
)
node
)
.
Identifier
,
ClassificationTypeNames
.
Identifier
);
AddClassification
(
identifier
.
Identifier
,
ClassificationTypeNames
.
Identifier
);
}
else
if
(
node
is
ParenthesizedExpressionSyntax
)
else
if
(
node
is
ParenthesizedExpressionSyntax
parenExpression
)
{
// (true)
var
expression
=
(
ParenthesizedExpressionSyntax
)
node
;
AddClassification
(
expression
.
OpenParenToken
,
ClassificationTypeNames
.
Punctuation
);
ClassifyPreprocessorExpression
(
expression
.
Expression
);
AddClassification
(
expression
.
CloseParenToken
,
ClassificationTypeNames
.
Punctuation
);
AddClassification
(
parenExpression
.
OpenParenToken
,
ClassificationTypeNames
.
Punctuation
);
ClassifyPreprocessorExpression
(
parenExpression
.
Expression
);
AddClassification
(
parenExpression
.
CloseParenToken
,
ClassificationTypeNames
.
Punctuation
);
}
else
if
(
node
is
PrefixUnaryExpressionSyntax
)
else
if
(
node
is
PrefixUnaryExpressionSyntax
prefixExpression
)
{
// !
var
expression
=
(
PrefixUnaryExpressionSyntax
)
node
;
AddClassification
(
expression
.
OperatorToken
,
ClassificationTypeNames
.
Operator
);
ClassifyPreprocessorExpression
(
expression
.
Operand
);
AddClassification
(
prefixExpression
.
OperatorToken
,
ClassificationTypeNames
.
Operator
);
ClassifyPreprocessorExpression
(
prefixExpression
.
Operand
);
}
else
if
(
node
is
BinaryExpressionSyntax
)
else
if
(
node
is
BinaryExpressionSyntax
binaryExpression
)
{
// &&, ||, ==, !=
var
expression
=
(
BinaryExpressionSyntax
)
node
;
ClassifyPreprocessorExpression
(
expression
.
Left
);
AddClassification
(
expression
.
OperatorToken
,
ClassificationTypeNames
.
Operator
);
ClassifyPreprocessorExpression
(
expression
.
Right
);
ClassifyPreprocessorExpression
(
binaryExpression
.
Left
);
AddClassification
(
binaryExpression
.
OperatorToken
,
ClassificationTypeNames
.
Operator
);
ClassifyPreprocessorExpression
(
binaryExpression
.
Right
);
}
}
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs
浏览文件 @
40f44bed
...
...
@@ -10,9 +10,9 @@ internal static class ArgumentGenerator
{
public
static
ArgumentSyntax
GenerateArgument
(
SyntaxNode
argument
)
{
if
(
argument
is
ExpressionSyntax
)
if
(
argument
is
ExpressionSyntax
expression
)
{
return
SyntaxFactory
.
Argument
(
(
ExpressionSyntax
)
argument
);
return
SyntaxFactory
.
Argument
(
expression
);
}
return
(
ArgumentSyntax
)
argument
;
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs
浏览文件 @
40f44bed
...
...
@@ -42,9 +42,9 @@ protected override IComparer<SyntaxNode> GetMemberComparer()
protected
override
IList
<
bool
>
GetAvailableInsertionIndices
(
SyntaxNode
destination
,
CancellationToken
cancellationToken
)
{
if
(
destination
is
TypeDeclarationSyntax
)
if
(
destination
is
TypeDeclarationSyntax
typeDeclaration
)
{
return
GetInsertionIndices
(
(
TypeDeclarationSyntax
)
destin
ation
,
cancellationToken
);
return
GetInsertionIndices
(
typeDeclar
ation
,
cancellationToken
);
}
// TODO(cyrusn): This will make is so that we can't generate into an enum, namespace, or
...
...
@@ -125,11 +125,10 @@ protected override TDeclarationNode AddMethod<TDeclarationNode>(TDeclarationNode
{
return
destination
;
}
// we will ignore the method if the associated property can be generated.
if
(
method
.
AssociatedSymbol
is
IPropertySymbol
)
if
(
method
.
AssociatedSymbol
is
IPropertySymbol
property
)
{
// we will ignore the method if the associated property can be generated.
var
property
=
(
IPropertySymbol
)
method
.
AssociatedSymbol
;
if
(
PropertyGenerator
.
CanBeGenerated
(
property
))
{
return
destination
;
...
...
@@ -196,9 +195,9 @@ protected override TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNo
{
var
getMethod
=
property
.
GetMethod
;
if
(
property
is
CodeGenerationSymbol
)
if
(
property
is
CodeGenerationSymbol
codeGenSymbol
)
{
foreach
(
var
annotation
in
((
CodeGenerationSymbol
)
property
)
.
GetAnnotations
())
foreach
(
var
annotation
in
codeGenSymbol
.
GetAnnotations
())
{
getMethod
=
annotation
.
AddAnnotationToSymbol
(
getMethod
);
}
...
...
@@ -211,9 +210,9 @@ protected override TDeclarationNode AddProperty<TDeclarationNode>(TDeclarationNo
{
var
setMethod
=
property
.
SetMethod
;
if
(
property
is
CodeGenerationSymbol
)
if
(
property
is
CodeGenerationSymbol
codeGenSymbol
)
{
foreach
(
var
annotation
in
((
CodeGenerationSymbol
)
property
)
.
GetAnnotations
())
foreach
(
var
annotation
in
codeGenSymbol
.
GetAnnotations
())
{
setMethod
=
annotation
.
AddAnnotationToSymbol
(
setMethod
);
}
...
...
@@ -603,11 +602,10 @@ public override SyntaxNode CreateFieldDeclaration(IFieldSymbol field, CodeGenera
{
return
null
;
}
// we will ignore the method if the associated property can be generated.
if
(
method
.
AssociatedSymbol
is
IPropertySymbol
)
if
(
method
.
AssociatedSymbol
is
IPropertySymbol
property
)
{
// we will ignore the method if the associated property can be generated.
var
property
=
(
IPropertySymbol
)
method
.
AssociatedSymbol
;
if
(
PropertyGenerator
.
CanBeGenerated
(
property
))
{
return
null
;
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs
浏览文件 @
40f44bed
...
...
@@ -123,9 +123,8 @@ private static ExpressionSyntax GenerateCharLiteralExpression(char val)
private
static
string
DetermineSuffix
(
ITypeSymbol
type
,
object
value
)
{
if
(
value
is
float
)
if
(
value
is
float
f
)
{
var
f
=
(
float
)
value
;
var
stringValue
=
((
IFormattable
)
value
).
ToString
(
"R"
,
CultureInfo
.
InvariantCulture
);
var
isNotSingle
=
!
IsSpecialType
(
type
,
SpecialType
.
System_Single
);
...
...
@@ -159,9 +158,8 @@ private static string DetermineSuffix(ITypeSymbol type, object value)
return
"UL"
;
}
if
(
value
is
decimal
)
if
(
value
is
decimal
d
)
{
var
d
=
(
decimal
)
value
;
var
scale
=
d
.
GetScale
();
var
isNotDecimal
=
!
IsSpecialType
(
type
,
SpecialType
.
System_Decimal
);
...
...
src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs
浏览文件 @
40f44bed
...
...
@@ -139,9 +139,8 @@ private static SyntaxList<UsingDirectiveSyntax> GenerateUsingDirectives(INamespa
private
static
UsingDirectiveSyntax
GenerateUsingDirective
(
ISymbol
symbol
)
{
if
(
symbol
is
IAliasSymbol
)
if
(
symbol
is
IAliasSymbol
alias
)
{
var
alias
=
(
IAliasSymbol
)
symbol
;
var
name
=
GenerateName
(
alias
.
Target
);
if
(
name
!=
null
)
{
...
...
@@ -150,9 +149,9 @@ private static UsingDirectiveSyntax GenerateUsingDirective(ISymbol symbol)
name
);
}
}
else
if
(
symbol
is
INamespaceOrTypeSymbol
)
else
if
(
symbol
is
INamespaceOrTypeSymbol
namespaceOrType
)
{
var
name
=
GenerateName
(
(
INamespaceOrTypeSymbol
)
symbol
);
var
name
=
GenerateName
(
namespaceOrType
);
if
(
name
!=
null
)
{
return
SyntaxFactory
.
UsingDirective
(
name
);
...
...
@@ -164,9 +163,9 @@ private static UsingDirectiveSyntax GenerateUsingDirective(ISymbol symbol)
private
static
NameSyntax
GenerateName
(
INamespaceOrTypeSymbol
symbol
)
{
if
(
symbol
is
ITypeSymbol
)
if
(
symbol
is
ITypeSymbol
type
)
{
return
((
ITypeSymbol
)
symbol
)
.
GenerateTypeSyntax
()
as
NameSyntax
;
return
type
.
GenerateTypeSyntax
()
as
NameSyntax
;
}
else
{
...
...
src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs
浏览文件 @
40f44bed
...
...
@@ -43,14 +43,11 @@ internal static class CrefSyntaxExtensions
return
false
;
}
if
(
symbol
is
INamespaceOrTypeSymbol
)
if
(
symbol
is
INamespaceOrTypeSymbol
namespaceOrTypeSymbol
)
{
var
namespaceOrTypeSymbol
=
(
INamespaceOrTypeSymbol
)
symbol
;
// 1. Check for Predefined Types
if
(
symbol
is
INamedTypeSymbol
)
if
(
symbol
is
INamedTypeSymbol
namedSymbol
)
{
var
namedSymbol
=
(
INamedTypeSymbol
)
symbol
;
var
keywordKind
=
ExpressionSyntaxExtensions
.
GetPredefinedKeywordKind
(
namedSymbol
.
SpecialType
);
if
(
keywordKind
!=
SyntaxKind
.
None
)
...
...
src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs
浏览文件 @
40f44bed
...
...
@@ -254,9 +254,9 @@ public static bool TryGetNameParts(this ExpressionSyntax expression, List<string
return
AddSimpleName
(
qualifiedName
.
Right
,
parts
);
}
else
if
(
expression
is
SimpleNameSyntax
)
else
if
(
expression
is
SimpleNameSyntax
simpleName
)
{
return
AddSimpleName
(
(
SimpleNameSyntax
)
expression
,
parts
);
return
AddSimpleName
(
simpleName
,
parts
);
}
else
{
...
...
@@ -687,14 +687,12 @@ private static bool CanReplace(ISymbol symbol)
var
memberAccess
=
(
MemberAccessExpressionSyntax
)
expression
;
return
memberAccess
.
TryReduce
(
semanticModel
,
out
replacementNode
,
out
issueSpan
,
optionSet
,
cancellationToken
);
}
else
if
(
expression
is
NameSyntax
)
else
if
(
expression
is
NameSyntax
name
)
{
var
name
=
(
NameSyntax
)
expression
;
return
name
.
TryReduce
(
semanticModel
,
out
replacementNode
,
out
issueSpan
,
optionSet
,
cancellationToken
);
}
else
if
(
expression
is
TypeSyntax
)
else
if
(
expression
is
TypeSyntax
typeName
)
{
var
typeName
=
(
TypeSyntax
)
expression
;
return
typeName
.
IsReplaceableByVar
(
semanticModel
,
out
replacementNode
,
out
issueSpan
,
optionSet
,
cancellationToken
);
}
...
...
@@ -909,18 +907,16 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
// The following condition checks if the user has used alias in the original code and
// if so the expression is replaced with the Alias
if
(
node
is
QualifiedNameSyntax
)
if
(
node
is
QualifiedNameSyntax
qualifiedNameNode
)
{
var
qualifiedNameNode
=
(
QualifiedNameSyntax
)
node
;
if
(
qualifiedNameNode
.
Right
.
Identifier
.
HasAnnotations
(
AliasAnnotation
.
Kind
))
{
aliasAnnotationInfo
=
qualifiedNameNode
.
Right
.
Identifier
.
GetAnnotations
(
AliasAnnotation
.
Kind
).
Single
();
}
}
if
(
node
is
AliasQualifiedNameSyntax
)
if
(
node
is
AliasQualifiedNameSyntax
aliasQualifiedNameNode
)
{
var
aliasQualifiedNameNode
=
(
AliasQualifiedNameSyntax
)
node
;
if
(
aliasQualifiedNameNode
.
Name
.
Identifier
.
HasAnnotations
(
AliasAnnotation
.
Kind
))
{
aliasAnnotationInfo
=
aliasQualifiedNameNode
.
Name
.
Identifier
.
GetAnnotations
(
AliasAnnotation
.
Kind
).
Single
();
...
...
@@ -955,9 +951,8 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
return
false
;
}
if
(
node
is
QualifiedNameSyntax
)
if
(
node
is
QualifiedNameSyntax
qualifiedName
)
{
var
qualifiedName
=
(
QualifiedNameSyntax
)
node
;
if
(!
qualifiedName
.
Right
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
{
var
type
=
semanticModel
.
GetTypeInfo
(
node
,
cancellationToken
).
Type
;
...
...
@@ -972,9 +967,8 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode
}
}
if
(
node
is
AliasQualifiedNameSyntax
)
if
(
node
is
AliasQualifiedNameSyntax
aliasQualifiedNameSyntax
)
{
var
aliasQualifiedNameSyntax
=
(
AliasQualifiedNameSyntax
)
node
;
if
(!
aliasQualifiedNameSyntax
.
Name
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
{
var
type
=
semanticModel
.
GetTypeInfo
(
node
,
cancellationToken
).
Type
;
...
...
@@ -1165,9 +1159,9 @@ private static int GetNamespaceId(SyntaxList<MemberDeclarationSyntax> members, N
// However, in the case of "A.B.C<>.D", then we'll only consider simplifying up to the
// first open name. This is because if we remove the open name, we'll often change
// meaning as "D" will bind to C<T>.D which is different than C<>.D!
if
(
name
is
QualifiedNameSyntax
)
if
(
name
is
QualifiedNameSyntax
qualifiedName
)
{
var
left
=
((
QualifiedNameSyntax
)
name
)
.
Left
;
var
left
=
qualifiedName
.
Left
;
if
(
ContainsOpenName
(
left
))
{
// Don't simplify A.B<>.C
...
...
@@ -1284,11 +1278,11 @@ private static int GetNamespaceId(SyntaxList<MemberDeclarationSyntax> members, N
// the left part of the name in the unnecessary span to Not confuse uses.
if
(
name
.
Kind
()
==
SyntaxKind
.
QualifiedName
)
{
QualifiedNameSyntax
qualifiedName
=
(
QualifiedNameSyntax
)
name
;
var
qualifiedName3
=
(
QualifiedNameSyntax
)
name
;
if
(
qualifiedName
.
Right
.
Identifier
.
ValueText
==
identifierToken
.
ValueText
)
if
(
qualifiedName
3
.
Right
.
Identifier
.
ValueText
==
identifierToken
.
ValueText
)
{
issueSpan
=
qualifiedName
.
Left
.
Span
;
issueSpan
=
qualifiedName
3
.
Left
.
Span
;
}
}
...
...
@@ -1320,27 +1314,24 @@ private static int GetNamespaceId(SyntaxList<MemberDeclarationSyntax> members, N
var
nameHasNoAlias
=
false
;
if
(
name
is
SimpleNameSyntax
)
if
(
name
is
SimpleNameSyntax
simpleName
)
{
var
simpleName
=
(
SimpleNameSyntax
)
name
;
if
(!
simpleName
.
Identifier
.
HasAnnotations
(
AliasAnnotation
.
Kind
))
{
nameHasNoAlias
=
true
;
}
}
if
(
name
is
QualifiedNameSyntax
)
if
(
name
is
QualifiedNameSyntax
qualifiedName2
)
{
var
qualifiedName
=
(
QualifiedNameSyntax
)
name
;
if
(!
qualifiedName
.
Right
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
if
(!
qualifiedName2
.
Right
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
{
nameHasNoAlias
=
true
;
}
}
if
(
name
is
AliasQualifiedNameSyntax
)
if
(
name
is
AliasQualifiedNameSyntax
aliasQualifiedName
)
{
var
aliasQualifiedName
=
(
AliasQualifiedNameSyntax
)
name
;
if
(
aliasQualifiedName
.
Name
is
SimpleNameSyntax
&&
!
aliasQualifiedName
.
Name
.
Identifier
.
HasAnnotations
(
AliasAnnotation
.
Kind
)
&&
!
aliasQualifiedName
.
Name
.
HasAnnotation
(
Simplifier
.
SpecialTypeAnnotation
))
...
...
@@ -1721,25 +1712,23 @@ private static bool ReplacementChangesSemantics(ExpressionSyntax originalExpress
if
(
rightSymbol
!=
null
&&
(
rightSymbol
.
IsStatic
||
rightSymbol
.
Kind
==
SymbolKind
.
NamedType
))
{
// Static member access or nested type member access.
INamedTypeSymbol
containingType
=
rightSymbol
.
ContainingType
;
var
containingType
=
rightSymbol
.
ContainingType
;
var
enclosingSymbol
=
semanticModel
.
GetEnclosingSymbol
(
left
.
SpanStart
);
List
<
ISymbol
>
enclosingTypeParametersInsideOut
=
new
List
<
ISymbol
>();
var
enclosingTypeParametersInsideOut
=
new
List
<
ISymbol
>();
while
(
enclosingSymbol
!=
null
)
{
if
(
enclosingSymbol
is
IMethodSymbol
)
if
(
enclosingSymbol
is
IMethodSymbol
methodSymbol
)
{
var
methodSymbol
=
(
IMethodSymbol
)
enclosingSymbol
;
if
(
methodSymbol
.
TypeArguments
.
Length
!=
0
)
{
enclosingTypeParametersInsideOut
.
AddRange
(
methodSymbol
.
TypeArguments
);
}
}
if
(
enclosingSymbol
is
INamedTypeSymbol
)
if
(
enclosingSymbol
is
INamedTypeSymbol
namedTypeSymbol
)
{
var
namedTypeSymbol
=
(
INamedTypeSymbol
)
enclosingSymbol
;
if
(
namedTypeSymbol
.
TypeArguments
.
Length
!=
0
)
{
enclosingTypeParametersInsideOut
.
AddRange
(
namedTypeSymbol
.
TypeArguments
);
...
...
@@ -2203,14 +2192,13 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA
private
static
bool
ContainsOpenName
(
NameSyntax
name
)
{
if
(
name
is
QualifiedNameSyntax
)
if
(
name
is
QualifiedNameSyntax
qualifiedName
)
{
var
qualifiedName
=
(
QualifiedNameSyntax
)
name
;
return
ContainsOpenName
(
qualifiedName
.
Left
)
||
ContainsOpenName
(
qualifiedName
.
Right
);
}
else
if
(
name
is
GenericNameSyntax
)
else
if
(
name
is
GenericNameSyntax
genericName
)
{
return
((
GenericNameSyntax
)
name
)
.
IsUnboundGenericName
;
return
genericName
.
IsUnboundGenericName
;
}
else
{
...
...
src/Workspaces/CSharp/Portable/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs
浏览文件 @
40f44bed
...
...
@@ -200,10 +200,10 @@ public override TypeSyntax VisitNamedType(INamedTypeSymbol symbol)
else
{
var
containingTypeSyntax
=
symbol
.
ContainingType
.
Accept
(
this
);
if
(
containingTypeSyntax
is
NameSyntax
)
if
(
containingTypeSyntax
is
NameSyntax
name
)
{
return
AddInformationTo
(
SyntaxFactory
.
QualifiedName
(
(
NameSyntax
)
containingTypeSyntax
,
simpleNameSyntax
),
SyntaxFactory
.
QualifiedName
(
name
,
simpleNameSyntax
),
symbol
);
}
else
...
...
src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs
浏览文件 @
40f44bed
...
...
@@ -212,25 +212,24 @@ private static bool CanBindToken(SyntaxToken token)
{
return
((
IdentifierNameSyntax
)
current
).
Identifier
.
ValueText
.
ToCamelCase
();
}
else
if
(
current
is
MemberAccessExpressionSyntax
)
else
if
(
current
is
MemberAccessExpressionSyntax
memberAccess
)
{
return
((
MemberAccessExpressionSyntax
)
current
)
.
Name
.
Identifier
.
ValueText
.
ToCamelCase
();
return
memberAccess
.
Name
.
Identifier
.
ValueText
.
ToCamelCase
();
}
else
if
(
current
is
MemberBindingExpressionSyntax
)
else
if
(
current
is
MemberBindingExpressionSyntax
memberBinding
)
{
return
((
MemberBindingExpressionSyntax
)
current
)
.
Name
.
Identifier
.
ValueText
.
ToCamelCase
();
return
memberBinding
.
Name
.
Identifier
.
ValueText
.
ToCamelCase
();
}
else
if
(
current
is
ConditionalAccessExpressionSyntax
)
else
if
(
current
is
ConditionalAccessExpressionSyntax
conditionalAccess
)
{
current
=
((
ConditionalAccessExpressionSyntax
)
current
)
.
WhenNotNull
;
current
=
conditionalAccess
.
WhenNotNull
;
}
else
if
(
current
is
CastExpressionSyntax
)
else
if
(
current
is
CastExpressionSyntax
castExpression
)
{
current
=
((
CastExpressionSyntax
)
current
)
.
Expression
;
current
=
castExpression
.
Expression
;
}
else
if
(
current
is
DeclarationExpressionSyntax
)
else
if
(
current
is
DeclarationExpressionSyntax
decl
)
{
var
decl
=
(
DeclarationExpressionSyntax
)
current
;
var
name
=
decl
.
Designation
as
SingleVariableDesignationSyntax
;
if
(
name
==
null
)
{
...
...
src/Workspaces/CSharp/Portable/Extensions/SyntaxTreeExtensions.cs
浏览文件 @
40f44bed
...
...
@@ -205,9 +205,8 @@ public static bool IsCrefContext(this SyntaxTree syntaxTree, int position, Cance
var
token
=
syntaxTree
.
FindTokenOnLeftOfPosition
(
position
,
cancellationToken
,
includeDocumentationComments
:
true
);
token
=
token
.
GetPreviousTokenIfTouchingWord
(
position
);
if
(
token
.
Parent
is
XmlCrefAttributeSyntax
)
if
(
token
.
Parent
is
XmlCrefAttributeSyntax
attribute
)
{
var
attribute
=
(
XmlCrefAttributeSyntax
)
token
.
Parent
;
return
token
==
attribute
.
StartQuoteToken
;
}
...
...
@@ -503,9 +502,8 @@ private static bool AtEndOfIncompleteStringOrCharLiteral(SyntaxToken token, int
}
var
structure
=
triviaTok
.
GetStructure
();
if
(
structure
is
BranchingDirectiveTriviaSyntax
)
if
(
structure
is
BranchingDirectiveTriviaSyntax
branch
)
{
var
branch
=
(
BranchingDirectiveTriviaSyntax
)
structure
;
return
!
branch
.
IsActive
||
!
branch
.
BranchTaken
;
}
}
...
...
src/Workspaces/CSharp/Portable/Formatting/Rules/ElasticTriviaFormattingRule.cs
浏览文件 @
40f44bed
...
...
@@ -207,9 +207,8 @@ private AdjustNewLinesOperation GetAdjustNewLinesOperationBetweenMembers(SyntaxT
}
// Don't insert a blank line between properties, indexers or events with no accessors
if
(
previousMember
is
BasePropertyDeclarationSyntax
)
if
(
previousMember
is
BasePropertyDeclarationSyntax
previousProperty
)
{
var
previousProperty
=
(
BasePropertyDeclarationSyntax
)
previousMember
;
var
nextProperty
=
(
BasePropertyDeclarationSyntax
)
nextMember
;
if
(
previousProperty
?.
AccessorList
?.
Accessors
.
All
(
a
=>
a
.
Body
==
null
)
==
true
&&
...
...
@@ -220,9 +219,8 @@ private AdjustNewLinesOperation GetAdjustNewLinesOperationBetweenMembers(SyntaxT
}
// Don't insert a blank line between methods with no bodies
if
(
previousMember
is
BaseMethodDeclarationSyntax
)
if
(
previousMember
is
BaseMethodDeclarationSyntax
previousMethod
)
{
var
previousMethod
=
(
BaseMethodDeclarationSyntax
)
previousMember
;
var
nextMethod
=
(
BaseMethodDeclarationSyntax
)
nextMember
;
if
(
previousMethod
.
Body
==
null
&&
...
...
@@ -297,11 +295,10 @@ private int LineBreaksAfter(SyntaxToken previousToken, SyntaxToken currentToken)
||
currentToken
.
Kind
()
==
SyntaxKind
.
OpenBraceToken
)
?
1
:
0
;
case
SyntaxKind
.
CloseBracketToken
:
if
(
previousToken
.
Parent
is
AttributeListSyntax
)
// Assembly and module-level attributes followed by non-attributes should have
// a blank line after them.
if
(
previousToken
.
Parent
is
AttributeListSyntax
parent
)
{
// Assembly and module-level attributes followed by non-attributes should have
// a blank line after them.
var
parent
=
(
AttributeListSyntax
)
previousToken
.
Parent
;
if
(
parent
.
Target
!=
null
&&
(
parent
.
Target
.
Identifier
.
IsKindOrHasMatchingText
(
SyntaxKind
.
AssemblyKeyword
)
||
parent
.
Target
.
Identifier
.
IsKindOrHasMatchingText
(
SyntaxKind
.
ModuleKeyword
)))
...
...
@@ -359,11 +356,10 @@ private int LineBreaksAfter(SyntaxToken previousToken, SyntaxToken currentToken)
return
1
;
case
SyntaxKind
.
OpenBracketToken
:
if
(
currentToken
.
Parent
is
AttributeListSyntax
)
// Assembly and module-level attributes preceded by non-attributes should have
// a blank line separating them.
if
(
currentToken
.
Parent
is
AttributeListSyntax
parent
)
{
// Assembly and module-level attributes preceded by non-attributes should have
// a blank line separating them.
var
parent
=
(
AttributeListSyntax
)
currentToken
.
Parent
;
if
(
parent
.
Target
!=
null
)
{
if
(
parent
.
Target
.
Identifier
==
SyntaxFactory
.
Token
(
SyntaxKind
.
AssemblyKeyword
)
||
...
...
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
40f44bed
...
...
@@ -1012,17 +1012,17 @@ private void ProcessUsings(List<Dictionary<string, string>> aliasMaps, SyntaxLis
private
string
GetTypeName
(
TypeSyntax
type
)
{
if
(
type
is
SimpleNameSyntax
)
if
(
type
is
SimpleNameSyntax
simpleName
)
{
return
GetSimpleTypeName
(
(
SimpleNameSyntax
)
typ
e
);
return
GetSimpleTypeName
(
simpleNam
e
);
}
else
if
(
type
is
QualifiedNameSyntax
)
else
if
(
type
is
QualifiedNameSyntax
qualifiedName
)
{
return
GetSimpleTypeName
(
((
QualifiedNameSyntax
)
type
)
.
Right
);
return
GetSimpleTypeName
(
qualifiedName
.
Right
);
}
else
if
(
type
is
AliasQualifiedNameSyntax
)
else
if
(
type
is
AliasQualifiedNameSyntax
aliasName
)
{
return
GetSimpleTypeName
(
((
AliasQualifiedNameSyntax
)
type
)
.
Name
);
return
GetSimpleTypeName
(
aliasName
.
Name
);
}
return
null
;
...
...
@@ -1516,9 +1516,8 @@ public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int p
}
var
structure
=
triviaTok
.
GetStructure
();
if
(
structure
is
BranchingDirectiveTriviaSyntax
)
if
(
structure
is
BranchingDirectiveTriviaSyntax
branch
)
{
var
branch
=
(
BranchingDirectiveTriviaSyntax
)
structure
;
return
!
branch
.
IsActive
||
!
branch
.
BranchTaken
?
TextSpan
.
FromBounds
(
branch
.
FullSpan
.
Start
,
position
)
:
default
(
TextSpan
);
}
}
...
...
src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs
浏览文件 @
40f44bed
...
...
@@ -1609,15 +1609,13 @@ private IEnumerable<TypeInferenceInfo> InferTypeInNameColon(NameColonSyntax name
private
ITypeSymbol
InferTypeForFirstParameterOfLambda
(
LambdaExpressionSyntax
lambdaExpression
)
{
if
(
lambdaExpression
is
ParenthesizedLambdaExpressionSyntax
)
if
(
lambdaExpression
is
ParenthesizedLambdaExpressionSyntax
parenLambda
)
{
return
InferTypeForFirstParameterOfParenthesizedLambda
(
(
ParenthesizedLambdaExpressionSyntax
)
lambdaExpression
);
return
InferTypeForFirstParameterOfParenthesizedLambda
(
parenLambda
);
}
else
if
(
lambdaExpression
is
SimpleLambdaExpressionSyntax
)
else
if
(
lambdaExpression
is
SimpleLambdaExpressionSyntax
simpleLambda
)
{
return
InferTypeForFirstParameterOfSimpleLambda
(
(
SimpleLambdaExpressionSyntax
)
lambdaExpression
);
return
InferTypeForFirstParameterOfSimpleLambda
(
simpleLambda
);
}
return
null
;
...
...
@@ -1784,12 +1782,12 @@ private IEnumerable<TypeInferenceInfo> InferTypeInYieldStatement(YieldStatementS
var
memberType
=
GetMemberType
(
memberSymbol
);
if
(
memberType
is
INamedTypeSymbol
)
if
(
memberType
is
INamedTypeSymbol
namedType
)
{
if
(
memberType
.
OriginalDefinition
.
SpecialType
==
SpecialType
.
System_Collections_Generic_IEnumerable_T
||
memberType
.
OriginalDefinition
.
SpecialType
==
SpecialType
.
System_Collections_Generic_IEnumerator_T
)
{
return
SpecializedCollections
.
SingletonEnumerable
(
new
TypeInferenceInfo
(
((
INamedTypeSymbol
)
memberType
)
.
TypeArguments
[
0
]));
return
SpecializedCollections
.
SingletonEnumerable
(
new
TypeInferenceInfo
(
namedType
.
TypeArguments
[
0
]));
}
}
...
...
src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs
浏览文件 @
40f44bed
...
...
@@ -401,9 +401,9 @@ private static ImmutableArray<ISymbol> GetSymbolsForNamespaceDeclarationNameCont
var
leftHandBinding
=
context
.
SemanticModel
.
GetSymbolInfo
(
expression
,
cancellationToken
);
var
container
=
context
.
SemanticModel
.
GetTypeInfo
(
expression
,
cancellationToken
).
Type
;
if
(
container
is
IPointerTypeSymbol
)
if
(
container
is
IPointerTypeSymbol
pointerType
)
{
container
=
((
IPointerTypeSymbol
)
container
)
.
PointedAtType
;
container
=
pointerType
.
PointedAtType
;
}
return
GetSymbolsOffOfBoundExpression
(
context
,
originalExpression
,
expression
,
leftHandBinding
,
container
,
cancellationToken
);
...
...
src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs
浏览文件 @
40f44bed
...
...
@@ -355,9 +355,8 @@ private async Task<SyntaxToken> RenameAndAnnotateAsync(SyntaxToken token, Syntax
var
sourceDefinition
=
await
SymbolFinder
.
FindSourceDefinitionAsync
(
symbol
,
_solution
,
_cancellationToken
).
ConfigureAwait
(
false
);
symbol
=
sourceDefinition
??
symbol
;
if
(
symbol
is
INamedTypeSymbol
)
if
(
symbol
is
INamedTypeSymbol
namedTypeSymbol
)
{
var
namedTypeSymbol
=
(
INamedTypeSymbol
)
symbol
;
if
(
namedTypeSymbol
.
IsImplicitlyDeclared
&&
namedTypeSymbol
.
IsDelegateType
()
&&
namedTypeSymbol
.
AssociatedSymbol
!=
null
)
...
...
@@ -1235,9 +1234,9 @@ public static SemanticModel GetSemanticModelForNode(SyntaxNode node, SemanticMod
{
nodeToSpeculate
=
((
TypeConstraintSyntax
)
node
).
Type
;
}
else
if
(
node
is
BaseTypeSyntax
)
else
if
(
node
is
BaseTypeSyntax
baseType
)
{
nodeToSpeculate
=
((
BaseTypeSyntax
)
node
)
.
Type
;
nodeToSpeculate
=
baseType
.
Type
;
}
else
{
...
...
src/Workspaces/CSharp/Portable/Simplification/AbstractCSharpReducer.AbstractExpressionRewriter.cs
浏览文件 @
40f44bed
...
...
@@ -36,14 +36,14 @@ protected AbstractExpressionRewriter(OptionSet optionSet, CancellationToken canc
private
static
SyntaxNode
GetParentNode
(
SyntaxNode
node
)
{
if
(
node
is
ExpressionSyntax
)
if
(
node
is
ExpressionSyntax
expression
)
{
return
GetParentNode
(
(
ExpressionSyntax
)
node
);
return
GetParentNode
(
expression
);
}
if
(
node
is
CrefSyntax
)
if
(
node
is
CrefSyntax
cref
)
{
return
GetParentNode
(
(
CrefSyntax
)
node
);
return
GetParentNode
(
cref
);
}
return
null
;
...
...
src/Workspaces/CSharp/Portable/Simplification/CSharpEscapingReducer.cs
浏览文件 @
40f44bed
...
...
@@ -43,17 +43,17 @@ public override IExpressionRewriter CreateExpressionRewriter(OptionSet optionSet
var
enclosingLambdaExpression
=
parent
.
GetAncestorsOrThis
(
n
=>
(
n
is
SimpleLambdaExpressionSyntax
||
n
is
ParenthesizedLambdaExpressionSyntax
)).
FirstOrDefault
();
if
(
enclosingLambdaExpression
!=
null
)
{
if
(
enclosingLambdaExpression
is
SimpleLambdaExpressionSyntax
)
if
(
enclosingLambdaExpression
is
SimpleLambdaExpressionSyntax
simpleLambda
)
{
if
(
((
SimpleLambdaExpressionSyntax
)
enclosingLambdaExpression
)
.
AsyncKeyword
.
Kind
()
==
SyntaxKind
.
AsyncKeyword
)
if
(
simpleLambda
.
AsyncKeyword
.
Kind
()
==
SyntaxKind
.
AsyncKeyword
)
{
return
token
;
}
}
if
(
enclosingLambdaExpression
is
ParenthesizedLambdaExpressionSyntax
)
if
(
enclosingLambdaExpression
is
ParenthesizedLambdaExpressionSyntax
parenLamdba
)
{
if
(
((
ParenthesizedLambdaExpressionSyntax
)
enclosingLambdaExpression
)
.
AsyncKeyword
.
Kind
()
==
SyntaxKind
.
AsyncKeyword
)
if
(
parenLamdba
.
AsyncKeyword
.
Kind
()
==
SyntaxKind
.
AsyncKeyword
)
{
return
token
;
}
...
...
src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs
浏览文件 @
40f44bed
...
...
@@ -139,9 +139,8 @@ public override SyntaxNode VisitReturnStatement(ReturnStatementSyntax node)
{
var
newNode
=
base
.
VisitReturnStatement
(
node
);
if
(
newNode
is
ReturnStatementSyntax
)
if
(
newNode
is
ReturnStatementSyntax
newReturnStatement
)
{
var
newReturnStatement
=
(
ReturnStatementSyntax
)
newNode
;
if
(
newReturnStatement
.
Expression
!=
null
)
{
var
parentLambda
=
node
.
FirstAncestorOrSelf
<
LambdaExpressionSyntax
>();
...
...
@@ -166,9 +165,8 @@ public override SyntaxNode VisitParenthesizedLambdaExpression(ParenthesizedLambd
{
var
newNode
=
base
.
VisitParenthesizedLambdaExpression
(
node
);
if
(
newNode
is
ParenthesizedLambdaExpressionSyntax
)
if
(
newNode
is
ParenthesizedLambdaExpressionSyntax
parenthesizedLambda
)
{
var
parenthesizedLambda
=
(
ParenthesizedLambdaExpressionSyntax
)
newNode
;
// First, try to add a cast to the lambda.
if
(
TryGetLambdaExpressionBodyWithCast
(
node
,
parenthesizedLambda
,
out
var
newLambdaExpressionBodyWithCast
))
{
...
...
@@ -218,9 +216,8 @@ public override SyntaxNode VisitSimpleLambdaExpression(SimpleLambdaExpressionSyn
{
var
newNode
=
base
.
VisitSimpleLambdaExpression
(
node
);
if
(
newNode
is
SimpleLambdaExpressionSyntax
)
if
(
newNode
is
SimpleLambdaExpressionSyntax
simpleLambda
)
{
var
simpleLambda
=
(
SimpleLambdaExpressionSyntax
)
newNode
;
// First, try to add a cast to the lambda.
if
(
TryGetLambdaExpressionBodyWithCast
(
node
,
simpleLambda
,
out
var
newLambdaExpressionBodyWithCast
))
{
...
...
@@ -802,9 +799,8 @@ private void TypeArgumentsInAllContainingSymbol(ISymbol symbol, IList<ISymbol> t
return
;
}
if
(
symbol
is
INamedTypeSymbol
)
if
(
symbol
is
INamedTypeSymbol
namedTypedSymbol
)
{
var
namedTypedSymbol
=
(
INamedTypeSymbol
)
symbol
;
if
(
namedTypedSymbol
.
TypeArguments
.
Length
!=
0
)
{
foreach
(
var
typeArgument
in
namedTypedSymbol
.
TypeArguments
)
...
...
src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs
浏览文件 @
40f44bed
...
...
@@ -275,10 +275,10 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta
Debug
.
Assert
(
previousOriginalNode
==
null
||
previousOriginalNode
.
Parent
==
currentOriginalNode
);
Debug
.
Assert
(
previousReplacedNode
==
null
||
previousReplacedNode
.
Parent
==
currentReplacedNode
);
if
(
currentOriginalNode
is
BinaryExpressionSyntax
)
if
(
currentOriginalNode
is
BinaryExpressionSyntax
binaryExpression
)
{
// If replacing the node will result in a broken binary expression, we won't remove it.
return
ReplacementBreaksBinaryExpression
(
(
BinaryExpressionSyntax
)
currentOriginalNode
,
(
BinaryExpressionSyntax
)
currentReplacedNode
);
return
ReplacementBreaksBinaryExpression
(
binaryExpression
,
(
BinaryExpressionSyntax
)
currentReplacedNode
);
}
else
if
(
currentOriginalNode
.
Kind
()
==
SyntaxKind
.
LogicalNotExpression
)
{
...
...
@@ -288,18 +288,18 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta
{
return
ReplacementBreaksConditionalAccessExpression
((
ConditionalAccessExpressionSyntax
)
currentOriginalNode
,
(
ConditionalAccessExpressionSyntax
)
currentReplacedNode
);
}
else
if
(
currentOriginalNode
is
AssignmentExpressionSyntax
)
else
if
(
currentOriginalNode
is
AssignmentExpressionSyntax
assignment
)
{
// If replacing the node will result in a broken assignment expression, we won't remove it.
return
ReplacementBreaksAssignmentExpression
(
(
AssignmentExpressionSyntax
)
currentOriginalNode
,
(
AssignmentExpressionSyntax
)
currentReplacedNode
);
return
ReplacementBreaksAssignmentExpression
(
assignment
,
(
AssignmentExpressionSyntax
)
currentReplacedNode
);
}
else
if
(
currentOriginalNode
is
SelectOrGroupClauseSyntax
||
currentOriginalNode
is
OrderingSyntax
)
{
return
!
SymbolsAreCompatible
(
currentOriginalNode
,
currentReplacedNode
);
}
else
if
(
currentOriginalNode
is
QueryClauseSyntax
)
else
if
(
currentOriginalNode
is
QueryClauseSyntax
queryClause
)
{
return
ReplacementBreaksQueryClause
(
(
QueryClauseSyntax
)
currentOriginalNod
e
,
(
QueryClauseSyntax
)
currentReplacedNode
);
return
ReplacementBreaksQueryClause
(
queryClaus
e
,
(
QueryClauseSyntax
)
currentReplacedNode
);
}
else
if
(
currentOriginalNode
.
Kind
()
==
SyntaxKind
.
VariableDeclarator
)
{
...
...
@@ -416,9 +416,8 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta
}
}
}
else
if
(
currentOriginalNode
is
ConstructorInitializerSyntax
)
else
if
(
currentOriginalNode
is
ConstructorInitializerSyntax
originalCtorInitializer
)
{
var
originalCtorInitializer
=
(
ConstructorInitializerSyntax
)
currentOriginalNode
;
var
newCtorInitializer
=
(
ConstructorInitializerSyntax
)
currentReplacedNode
;
return
ReplacementBreaksConstructorInitializer
(
originalCtorInitializer
,
newCtorInitializer
);
}
...
...
@@ -435,9 +434,8 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta
{
return
!
TypesAreCompatible
((
ImplicitArrayCreationExpressionSyntax
)
currentOriginalNode
,
(
ImplicitArrayCreationExpressionSyntax
)
currentReplacedNode
);
}
else
if
(
currentOriginalNode
is
AnonymousObjectMemberDeclaratorSyntax
)
else
if
(
currentOriginalNode
is
AnonymousObjectMemberDeclaratorSyntax
originalAnonymousObjectMemberDeclarator
)
{
var
originalAnonymousObjectMemberDeclarator
=
(
AnonymousObjectMemberDeclaratorSyntax
)
currentOriginalNode
;
var
replacedAnonymousObjectMemberDeclarator
=
(
AnonymousObjectMemberDeclaratorSyntax
)
currentReplacedNode
;
return
ReplacementBreaksAnonymousObjectMemberDeclarator
(
originalAnonymousObjectMemberDeclarator
,
replacedAnonymousObjectMemberDeclarator
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录