Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d833c696
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,发现更多精彩内容 >>
提交
d833c696
编写于
3月 22, 2018
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add checks for unexpected usages of hte collection.
上级
414221ea
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
252 addition
and
42 deletion
+252
-42
src/EditorFeatures/CSharpTest/ConvertForToForEach/ConvertForToForEachTests.cs
...SharpTest/ConvertForToForEach/ConvertForToForEachTests.cs
+102
-0
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+6
-15
src/EditorFeatures/VisualBasicTest/ConvertForToForEach/ConvertForToForEachTests.vb
...BasicTest/ConvertForToForEach/ConvertForToForEachTests.vb
+3
-1
src/Features/Core/Portable/ConvertForToForEach/AbstractConvertForToForEachCodeRefactoringProvider.cs
...ach/AbstractConvertForToForEachCodeRefactoringProvider.cs
+50
-23
src/Features/Core/Portable/FeaturesResources.Designer.cs
src/Features/Core/Portable/FeaturesResources.Designer.cs
+9
-0
src/Features/Core/Portable/FeaturesResources.resx
src/Features/Core/Portable/FeaturesResources.resx
+4
-1
src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs
...ble/IntroduceVariable/AbstractIntroduceVariableService.cs
+1
-1
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
+5
-0
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
+5
-0
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
+3
-0
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
...anguageServices/SyntaxFactsService/ISyntaxFactsService.cs
+1
-0
src/Workspaces/Core/Portable/Shared/Extensions/SemanticEquivalence.cs
...es/Core/Portable/Shared/Extensions/SemanticEquivalence.cs
+4
-1
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
...ortable/LanguageServices/VisualBasicSyntaxFactsService.vb
+4
-0
未找到文件。
src/EditorFeatures/CSharpTest/ConvertForToForEach/ConvertForToForEachTests.cs
浏览文件 @
d833c696
...
...
@@ -91,6 +91,108 @@ void Test(string[] array)
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsConvertForToForEach
)]
public
async
Task
TestWarnIfCollectionPotentiallyMutated1
()
{
await
TestInRegularAndScript1Async
(
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
[||]for (int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i]);
list.Add(null);
}
}
}"
,
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
foreach (string {|Rename:v|} in list)
{
Console.WriteLine(v);
{|Warning:list|}.Add(null);
}
}
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsConvertForToForEach
)]
public
async
Task
TestWarnIfCollectionPotentiallyMutated2
()
{
await
TestInRegularAndScript1Async
(
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
[||]for (int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i]);
list = null;
}
}
}"
,
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
foreach (string {|Rename:v|} in list)
{
Console.WriteLine(v);
{|Warning:list|} = null;
}
}
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsConvertForToForEach
)]
public
async
Task
TestNoWarnIfCollectionPropertyAccess
()
{
await
TestInRegularAndScript1Async
(
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
[||]for (int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i]);
Console.WriteLine(list.Count);
}
}
}"
,
@"using System;
using System.Collections.Generic;
class C
{
void Test(IList<string> list)
{
foreach (string {|Rename:v|} in list)
{
Console.WriteLine(v);
Console.WriteLine(list.Count);
}
}
}"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsConvertForToForEach
)]
public
async
Task
TestNoWarnIfDoesNotCrossFunctionBoundary
()
{
...
...
src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
d833c696
...
...
@@ -421,24 +421,15 @@ public TestParameters WithFixProviderData(object fixProviderData)
void
TestAnnotations
(
ImmutableArray
<
TextSpan
>
expectedSpans
,
string
annotationKind
)
{
var
annotated
Tokens
=
fixedRoot
.
GetAnnotatedNodesAndTokens
(
annotationKind
).
Select
(
n
=>
(
SyntaxToken
)
n
).
ToList
();
var
annotated
Items
=
fixedRoot
.
GetAnnotatedNodesAndTokens
(
annotationKind
).
OrderBy
(
s
=>
s
.
SpanStart
).
ToList
();
Assert
.
Equal
(
expectedSpans
.
Length
,
annotated
Token
s
.
Count
);
Assert
.
Equal
(
expectedSpans
.
Length
,
annotated
Item
s
.
Count
);
if
(
expectedSpans
.
Length
>
0
)
for
(
var
i
=
0
;
i
<
Math
.
Min
(
expectedSpans
.
Length
,
annotatedItems
.
Count
);
i
++
)
{
var
expectedTokens
=
TokenUtilities
.
GetTokens
(
TokenUtilities
.
GetSyntaxRoot
(
expectedText
,
GetLanguage
(),
parseOptions
));
var
actualTokens
=
TokenUtilities
.
GetTokens
(
fixedRoot
);
for
(
var
i
=
0
;
i
<
Math
.
Min
(
expectedTokens
.
Count
,
actualTokens
.
Count
);
i
++)
{
var
expectedToken
=
expectedTokens
[
i
];
var
actualToken
=
actualTokens
[
i
];
var
actualIsConflict
=
annotatedTokens
.
Contains
(
actualToken
);
var
expectedIsConflict
=
expectedSpans
.
Contains
(
expectedToken
.
Span
);
Assert
.
Equal
(
expectedIsConflict
,
actualIsConflict
);
}
var
actual
=
annotatedItems
[
i
].
Span
;
var
expected
=
expectedSpans
[
i
];
Assert
.
Equal
(
expected
,
actual
);
}
}
}
...
...
src/EditorFeatures/VisualBasicTest/ConvertForToForEach/ConvertForToForEachTests.vb
浏览文件 @
d833c696
Imports
Microsoft.CodeAnalysis.CodeRefactorings
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
Microsoft.CodeAnalysis.CodeRefactorings
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings
Imports
Microsoft.CodeAnalysis.VisualBasic.ConvertForToForEach
...
...
src/Features/Core/Portable/ConvertForToForEach/AbstractConvertForToForEachCodeRefactoringProvider.cs
浏览文件 @
d833c696
...
...
@@ -161,7 +161,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
var
bodyStatements
=
GetBodyStatements
(
forStatement
);
foreach
(
var
statement
in
bodyStatements
)
{
if
(
i
terationVariableIsUsedForMoreThanCollectionIndex
(
statement
))
if
(
I
terationVariableIsUsedForMoreThanCollectionIndex
(
statement
))
{
return
;
}
...
...
@@ -173,8 +173,10 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
document
,
forStatement
,
iterationVariable
,
collectionExpression
,
containingType
,
collectionType
.
Type
,
iterationType
,
c
)));
return
;
// local functions
bool
i
terationVariableIsUsedForMoreThanCollectionIndex
(
SyntaxNode
current
)
bool
I
terationVariableIsUsedForMoreThanCollectionIndex
(
SyntaxNode
current
)
{
if
(
syntaxFacts
.
IsIdentifierName
(
current
))
{
...
...
@@ -215,7 +217,7 @@ bool iterationVariableIsUsedForMoreThanCollectionIndex(SyntaxNode current)
{
if
(
child
.
IsNode
)
{
if
(
i
terationVariableIsUsedForMoreThanCollectionIndex
(
child
.
AsNode
()))
if
(
I
terationVariableIsUsedForMoreThanCollectionIndex
(
child
.
AsNode
()))
{
return
true
;
}
...
...
@@ -327,7 +329,7 @@ bool iterationVariableIsUsedForMoreThanCollectionIndex(SyntaxNode current)
// var x = list[i] or
//
// If so, we'll use those as the iteration variables for the new foreach statement.
var
(
typeNode
,
foreachIdentifier
,
declarationStatement
)
=
t
ryDeconstructInitialDeclaration
();
var
(
typeNode
,
foreachIdentifier
,
declarationStatement
)
=
T
ryDeconstructInitialDeclaration
();
if
(
typeNode
==
null
)
{
...
...
@@ -355,7 +357,7 @@ bool iterationVariableIsUsedForMoreThanCollectionIndex(SyntaxNode current)
var
foreachIdentifierReference
=
foreachIdentifier
.
WithoutAnnotations
(
RenameAnnotation
.
Kind
).
WithoutTrivia
();
// Walk the for statement, replacing any matches we find.
f
indAndReplaceMatches
(
forStatement
);
F
indAndReplaceMatches
(
forStatement
);
// Finally, remove the declaration statement if we found one. Move all its leading
// trivia to the next statement.
...
...
@@ -375,7 +377,7 @@ bool iterationVariableIsUsedForMoreThanCollectionIndex(SyntaxNode current)
return
document
.
WithSyntaxRoot
(
editor
.
GetChangedRoot
());
// local functions
(
TTypeNode
,
SyntaxToken
,
TStatementSyntax
)
t
ryDeconstructInitialDeclaration
()
(
TTypeNode
,
SyntaxToken
,
TStatementSyntax
)
T
ryDeconstructInitialDeclaration
()
{
var
bodyStatements
=
GetBodyStatements
(
forStatement
);
...
...
@@ -407,40 +409,65 @@ bool iterationVariableIsUsedForMoreThanCollectionIndex(SyntaxNode current)
return
default
;
}
void
f
indAndReplaceMatches
(
SyntaxNode
current
)
void
F
indAndReplaceMatches
(
SyntaxNode
current
)
{
if
(
syntaxFacts
.
AreEquivalent
(
current
,
index
Expression
))
if
(
SemanticEquivalence
.
AreEquivalent
(
semanticModel
,
current
,
collection
Expression
))
{
if
(
syntaxFacts
.
AreEquivalent
(
current
.
Parent
,
indexExpression
))
{
var
indexMatch
=
current
.
Parent
;
// Found a match. replace with iteration variable.
var
replacementToken
=
foreachIdentifierReference
;
if
(
semanticFacts
.
IsWrittenTo
(
semanticModel
,
current
,
cancellationToken
))
if
(
semanticFacts
.
IsWrittenTo
(
semanticModel
,
indexMatch
,
cancellationToken
))
{
replacementToken
=
replacementToken
.
WithAdditionalAnnotations
(
WarningAnnotation
.
Create
(
FeaturesResources
.
Warning_colon_Collection_was_modified_during_iteration
));
}
if
(
c
rossesFunctionBoundary
(
current
))
if
(
C
rossesFunctionBoundary
(
current
))
{
replacementToken
=
replacementToken
.
WithAdditionalAnnotations
(
WarningAnnotation
.
Create
(
FeaturesResources
.
Warning_colon_Iteration_variable_crossed_function_boundary
));
}
var
replacement
=
generator
.
IdentifierName
(
replacementToken
).
WithTriviaFrom
(
current
);
editor
.
ReplaceNode
(
indexMatch
,
generator
.
IdentifierName
(
replacementToken
).
WithTriviaFrom
(
indexMatch
));
}
else
{
// Collection was used for some other purpose. If it's passed as an argument
// to something, or is written to, or has a method invoked on it, we'll warn
// that it's potentially changing and may break if you switch to a foreach loop.
var
shouldWarn
=
syntaxFacts
.
IsArgument
(
current
.
Parent
);
shouldWarn
|=
semanticFacts
.
IsWrittenTo
(
semanticModel
,
current
,
cancellationToken
);
shouldWarn
|=
syntaxFacts
.
IsAnyMemberAccessExpression
(
current
.
Parent
)
&&
syntaxFacts
.
IsInvocationExpression
(
current
.
Parent
.
Parent
);
editor
.
ReplaceNode
(
current
,
replacement
);
if
(
shouldWarn
)
{
editor
.
ReplaceNode
(
current
,
(
node
,
_
)
=>
node
.
WithAdditionalAnnotations
(
WarningAnnotation
.
Create
(
FeaturesResources
.
Warning_colon_Iteration_variable_crossed_function_boundary
)));
}
}
return
;
}
foreach
(
var
child
in
current
.
ChildNodesAndTokens
())
{
if
(
child
.
IsNode
)
{
f
indAndReplaceMatches
(
child
.
AsNode
());
F
indAndReplaceMatches
(
child
.
AsNode
());
}
}
}
bool
c
rossesFunctionBoundary
(
SyntaxNode
node
)
bool
C
rossesFunctionBoundary
(
SyntaxNode
node
)
{
var
containingFunction
=
node
.
AncestorsAndSelf
().
FirstOrDefault
(
n
=>
syntaxFacts
.
IsLocalFunctionStatement
(
n
)
||
syntaxFacts
.
IsAnonymousFunction
(
n
));
...
...
src/Features/Core/Portable/FeaturesResources.Designer.cs
浏览文件 @
d833c696
...
...
@@ -3698,6 +3698,15 @@ internal class FeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Warning: Collection may be modified during iteration..
/// </summary>
internal
static
string
Warning_colon_Collection_may_be_modified_during_iteration
{
get
{
return
ResourceManager
.
GetString
(
"Warning_colon_Collection_may_be_modified_during_iteration"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Warning: Collection was modified during iteration..
/// </summary>
...
...
src/Features/Core/Portable/FeaturesResources.resx
浏览文件 @
d833c696
...
...
@@ -1343,4 +1343,7 @@ This version used in: {2}</value>
<data
name=
"Warning_colon_Iteration_variable_crossed_function_boundary"
xml:space=
"preserve"
>
<value>
Warning: Iteration variable crossed function boundary.
</value>
</data>
<data
name=
"Warning_colon_Collection_may_be_modified_during_iteration"
xml:space=
"preserve"
>
<value>
Warning: Collection may be modified during iteration.
</value>
</data>
</root>
\ No newline at end of file
src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs
浏览文件 @
d833c696
...
...
@@ -271,7 +271,7 @@ where NodeMatchesExpression(originalSemanticModel, currentSemanticModel, syntaxF
if
(
allOccurrences
&&
this
.
CanReplace
(
nodeInCurrent
))
{
return
SemanticEquivalence
.
Are
Semantically
Equivalent
(
return
SemanticEquivalence
.
AreEquivalent
(
originalSemanticModel
,
currentSemanticModel
,
expressionInOriginal
,
nodeInCurrent
);
}
}
...
...
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Tato verze se používá zde: {2}.</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Diese Version wird verwendet in: {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Esta versión se utiliza en: {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Version utilisée dans : {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Questa versione è usata {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ This version used in: {2}</source>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ This version used in: {2}</source>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Ta wersja jest używana wersja: {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Essa versão é usada no: {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ This version used in: {2}</source>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ Bu sürüm şurada kullanılır: {2}</target>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ This version used in: {2}</source>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
浏览文件 @
d833c696
...
...
@@ -2000,6 +2000,11 @@ This version used in: {2}</source>
<target
state=
"new"
>
Warning: Iteration variable crossed function boundary.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Warning_colon_Collection_may_be_modified_during_iteration"
>
<source>
Warning: Collection may be modified during iteration.
</source>
<target
state=
"new"
>
Warning: Collection may be modified during iteration.
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
浏览文件 @
d833c696
...
...
@@ -691,6 +691,9 @@ public SyntaxNode GetExpressionOfArgument(SyntaxNode node)
public
RefKind
GetRefKindOfArgument
(
SyntaxNode
node
)
=>
(
node
as
ArgumentSyntax
).
GetRefKind
();
public
bool
IsArgument
(
SyntaxNode
node
)
=>
node
.
Kind
()
==
SyntaxKind
.
Argument
;
public
bool
IsSimpleArgument
(
SyntaxNode
node
)
{
var
argument
=
node
as
ArgumentSyntax
;
...
...
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
浏览文件 @
d833c696
...
...
@@ -166,6 +166,7 @@ internal interface ISyntaxFactsService : ILanguageService
/// no named params, no omitted args).
/// </summary>
bool
IsSimpleArgument
(
SyntaxNode
node
);
bool
IsArgument
(
SyntaxNode
node
);
RefKind
GetRefKindOfArgument
(
SyntaxNode
node
);
void
GetNameAndArityOfSimpleName
(
SyntaxNode
node
,
out
string
name
,
out
int
arity
);
...
...
src/Workspaces/Core/Portable/Shared/Extensions/SemanticEquivalence.cs
浏览文件 @
d833c696
...
...
@@ -9,7 +9,10 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions
{
internal
static
class
SemanticEquivalence
{
public
static
bool
AreSemanticallyEquivalent
(
public
static
bool
AreEquivalent
(
SemanticModel
semanticModel
,
SyntaxNode
node1
,
SyntaxNode
node2
)
=>
AreEquivalent
(
semanticModel
,
semanticModel
,
node1
,
node2
);
public
static
bool
AreEquivalent
(
SemanticModel
semanticModel1
,
SemanticModel
semanticModel2
,
SyntaxNode
node1
,
...
...
src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb
浏览文件 @
d833c696
...
...
@@ -633,6 +633,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
RefKind
.
None
End
Function
Public
Function
IsArgument
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsArgument
Return
TypeOf
node
Is
ArgumentSyntax
End
Function
Public
Function
IsSimpleArgument
(
node
As
SyntaxNode
)
As
Boolean
Implements
ISyntaxFactsService
.
IsSimpleArgument
Dim
argument
=
TryCast
(
node
,
ArgumentSyntax
)
Return
argument
IsNot
Nothing
AndAlso
Not
argument
.
IsNamed
AndAlso
Not
argument
.
IsOmitted
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录