Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c34025c9
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,发现更多精彩内容 >>
提交
c34025c9
编写于
7月 16, 2018
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make check stricter.
上级
eb2acf36
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
8 deletion
+59
-8
src/EditorFeatures/CSharpTest2/Recommendations/AsKeywordRecommenderTests.cs
.../CSharpTest2/Recommendations/AsKeywordRecommenderTests.cs
+15
-2
src/EditorFeatures/CSharpTest2/Recommendations/IsKeywordRecommenderTests.cs
.../CSharpTest2/Recommendations/IsKeywordRecommenderTests.cs
+15
-2
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/CSharpSyntaxContext.cs
...p/Portable/Extensions/ContextQuery/CSharpSyntaxContext.cs
+1
-1
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
.../Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
+11
-3
src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.cs
...p/Portable/LanguageServices/CSharpTypeInferenceService.cs
+2
-0
src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs
...able/Shared/Extensions/ITypeInferenceServiceExtensions.cs
+15
-0
未找到文件。
src/EditorFeatures/CSharpTest2/Recommendations/AsKeywordRecommenderTests.cs
浏览文件 @
c34025c9
...
...
@@ -120,8 +120,21 @@ public async Task TestNotWithinNumericLiteral()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
async
Task
TestNotAfterAsync
()
{
await
VerifyAbsenceAsync
(
AddInsideMethod
(
@"Goo(async $$"
));
await
VerifyAbsenceAsync
(
@"
using System;
class C
{
void Goo()
{
Bar(async $$
}
void Bar(Func<int, string> f)
{
}
}"
);
}
}
}
src/EditorFeatures/CSharpTest2/Recommendations/IsKeywordRecommenderTests.cs
浏览文件 @
c34025c9
...
...
@@ -172,8 +172,21 @@ public async Task TestNotWithinNumericLiteral()
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
async
Task
TestNotAfterAsync
()
{
await
VerifyAbsenceAsync
(
AddInsideMethod
(
@"Goo(async $$"
));
await
VerifyAbsenceAsync
(
@"
using System;
class C
{
void Goo()
{
Bar(async $$
}
void Bar(Func<int, string> f)
{
}
}"
);
}
}
}
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/CSharpSyntaxContext.cs
浏览文件 @
c34025c9
...
...
@@ -223,7 +223,7 @@ private static CSharpSyntaxContext CreateContextWorker(Workspace workspace, Sema
syntaxTree
.
IsLabelContext
(
position
,
cancellationToken
),
syntaxTree
.
IsTypeArgumentOfConstraintClause
(
position
,
cancellationToken
),
syntaxTree
.
IsRightOfDotOrArrowOrColonColon
(
position
,
cancellationToken
),
syntaxTree
.
IsIsOrAsContext
(
position
,
leftToken
,
cancellationToken
),
syntaxTree
.
IsIsOrAsContext
(
semanticModel
,
position
,
leftToken
,
cancellationToken
),
syntaxTree
.
IsObjectCreationTypeContext
(
position
,
leftToken
,
cancellationToken
),
syntaxTree
.
IsDefiniteCastTypeContext
(
position
,
leftToken
,
cancellationToken
),
syntaxTree
.
IsGenericTypeArgumentContext
(
position
,
leftToken
,
cancellationToken
),
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
浏览文件 @
c34025c9
...
...
@@ -2546,7 +2546,10 @@ public static bool IsNameOfContext(this SyntaxTree syntaxTree, int position, Sem
return
false
;
}
public
static
bool
IsIsOrAsContext
(
this
SyntaxTree
syntaxTree
,
int
position
,
SyntaxToken
tokenOnLeftOfPosition
,
CancellationToken
cancellationToken
)
public
static
bool
IsIsOrAsContext
(
this
SyntaxTree
syntaxTree
,
SemanticModel
semanticModel
,
int
position
,
SyntaxToken
tokenOnLeftOfPosition
,
CancellationToken
cancellationToken
)
{
// cases:
// expr |
...
...
@@ -2622,8 +2625,13 @@ public static bool IsIsOrAsContext(this SyntaxTree syntaxTree, int position, Syn
// async $$
//
// 'async' will look like a normal identifier. But we don't want to follow it
// with 'is' or 'as'.
return
false
;
// with 'is' or 'as' if it's actually the start of a lambda.
var
delegateType
=
CSharpTypeInferenceService
.
Instance
.
InferDelegateType
(
semanticModel
,
token
.
SpanStart
,
cancellationToken
);
if
(
delegateType
!=
null
)
{
return
false
;
}
}
// Now, make sure the name was actually in a location valid for
...
...
src/Workspaces/CSharp/Portable/LanguageServices/CSharpTypeInferenceService.cs
浏览文件 @
c34025c9
...
...
@@ -15,6 +15,8 @@ namespace Microsoft.CodeAnalysis.CSharp
[
ExportLanguageService
(
typeof
(
ITypeInferenceService
),
LanguageNames
.
CSharp
),
Shared
]
internal
partial
class
CSharpTypeInferenceService
:
AbstractTypeInferenceService
<
ExpressionSyntax
>
{
public
static
readonly
CSharpTypeInferenceService
Instance
=
new
CSharpTypeInferenceService
();
protected
override
AbstractTypeInferrer
CreateTypeInferrer
(
SemanticModel
semanticModel
,
CancellationToken
cancellationToken
)
{
return
new
TypeInferrer
(
semanticModel
,
cancellationToken
);
...
...
src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs
浏览文件 @
c34025c9
...
...
@@ -29,6 +29,21 @@ public static ImmutableArray<TypeInferenceInfo> GetTypeInferenceInfo(this ITypeI
CancellationToken
cancellationToken
)
{
var
types
=
typeInferenceService
.
InferTypes
(
semanticModel
,
expression
,
cancellationToken
);
return
GetFirstDelegateType
(
semanticModel
,
types
);
}
public
static
INamedTypeSymbol
InferDelegateType
(
this
ITypeInferenceService
typeInferenceService
,
SemanticModel
semanticModel
,
int
position
,
CancellationToken
cancellationToken
)
{
var
types
=
typeInferenceService
.
InferTypes
(
semanticModel
,
position
,
cancellationToken
);
return
GetFirstDelegateType
(
semanticModel
,
types
);
}
private
static
INamedTypeSymbol
GetFirstDelegateType
(
SemanticModel
semanticModel
,
ImmutableArray
<
ITypeSymbol
>
types
)
{
var
delegateTypes
=
types
.
Select
(
t
=>
t
.
GetDelegateType
(
semanticModel
.
Compilation
));
return
delegateTypes
.
WhereNotNull
().
FirstOrDefault
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录