Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1102ba50
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,发现更多精彩内容 >>
提交
1102ba50
编写于
3月 15, 2017
作者:
C
CyrusNajmabadi
提交者:
GitHub
3月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17868 from CyrusNajmabadi/missingParameterList
VB parameter lists can be missing. Be resilient to that.
上级
fc0ad38a
193221e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
12 deletion
+55
-12
src/Compilers/Core/Portable/Syntax/SyntaxNodeExtensions.cs
src/Compilers/Core/Portable/Syntax/SyntaxNodeExtensions.cs
+1
-3
src/EditorFeatures/VisualBasicTest/CodeActions/ReplaceMethodWithProperty/ReplaceMethodWithPropertyTests.vb
...placeMethodWithProperty/ReplaceMethodWithPropertyTests.vb
+16
-0
src/EditorFeatures/VisualBasicTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.vb
...ics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.vb
+21
-2
src/Features/VisualBasic/Portable/MakeMethodAsynchronous/VisualBasicMakeMethodAsynchronousCodeFixProvider.vb
...onous/VisualBasicMakeMethodAsynchronousCodeFixProvider.vb
+8
-5
src/Features/VisualBasic/Portable/ReplaceMethodWithProperty/VisualBasicReplaceMethodWithPropertyService.vb
...thProperty/VisualBasicReplaceMethodWithPropertyService.vb
+9
-2
未找到文件。
src/Compilers/Core/Portable/Syntax/SyntaxNodeExtensions.cs
浏览文件 @
1102ba50
...
...
@@ -409,9 +409,7 @@ public static SyntaxToken WithoutTrivia(this SyntaxToken token)
/// <summary>
/// Creates a new node from this node with the trailing trivia removed.
/// </summary>
public
static
TSyntax
WithoutTrailingTrivia
<
TSyntax
>(
this
TSyntax
node
)
where
TSyntax
:
SyntaxNode
public
static
TSyntax
WithoutTrailingTrivia
<
TSyntax
>(
this
TSyntax
node
)
where
TSyntax
:
SyntaxNode
{
return
node
.
WithTrailingTrivia
((
IEnumerable
<
SyntaxTrivia
>)
null
);
}
...
...
src/EditorFeatures/VisualBasicTest/CodeActions/ReplaceMethodWithProperty/ReplaceMethodWithPropertyTests.vb
浏览文件 @
1102ba50
...
...
@@ -27,6 +27,22 @@ End class",
End class"
)
End
Function
<
WorkItem
(
17368
,
"https://github.com/dotnet/roslyn/issues/17368"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)
>
Public
Async
Function
TestMissingParameterList
()
As
Task
Await
TestInRegularAndScript1Async
(
"class C
function [||]GetFoo as integer
End function
End class"
,
"class C
ReadOnly Property Foo as integer
Get
End Get
End Property
End class"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsReplaceMethodWithProperty
)
>
Public
Async
Function
TestMethodWithoutGetName
()
As
Task
Await
TestInRegularAndScriptAsync
(
...
...
src/EditorFeatures/VisualBasicTest/Diagnostics/MakeMethodAsynchronous/MakeMethodAsynchronousTests.vb
浏览文件 @
1102ba50
...
...
@@ -68,8 +68,7 @@ Module Program
Async Function TestAsync() As Task(Of Integer)
Await Task.Delay(1)
Function Sub
End Module"
)
End Module"
)
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsMakeMethodAsynchronous
)
>
...
...
@@ -389,5 +388,25 @@ End Module
</
File
>
Await
TestAsync
(
initial
,
expected
,
ignoreTrivia
:
=
False
)
End
Function
<
WorkItem
(
17368
,
"https://github.com/dotnet/roslyn/issues/17368"
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsMakeMethodAsynchronous
)
>
Public
Async
Function
TestWithMissingParameterList
()
As
Task
Await
TestInRegularAndScriptAsync
(
"Imports System
Imports System.Threading.Tasks
Module Program
Sub Test ' Comment
[|Await Task.Delay(1)|]
End Sub
End Module"
,
"Imports System
Imports System.Threading.Tasks
Module Program
Async Function TestAsync As Task ' Comment
Await Task.Delay(1)
End Function
End Module"
,
ignoreTrivia
:
=
False
)
End
Function
End
Class
End
Namespace
\ No newline at end of file
src/Features/VisualBasic/Portable/MakeMethodAsynchronous/VisualBasicMakeMethodAsynchronousCodeFixProvider.vb
浏览文件 @
1102ba50
...
...
@@ -91,16 +91,19 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.MakeMethodAsynchronous
' Have to convert this sub into a func.
Dim
subStatement
=
node
.
SubOrFunctionStatement
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
taskType
.
GenerateTypeSyntax
()).
WithTrailingTrivia
(
subStatement
.
ParameterList
.
GetTrailingTrivia
())
Dim
asClause
=
SyntaxFactory
.
SimpleAsClause
(
taskType
.
GenerateTypeSyntax
()).
WithTrailingTrivia
(
If
(
subStatement
.
ParameterList
?
.
GetTrailingTrivia
(),
subStatement
.
GetTrailingTrivia
()))
Dim
functionStatement
=
SyntaxFactory
.
FunctionStatement
(
subStatement
.
AttributeLists
,
subStatement
.
Modifiers
.
Add
(
s_asyncToken
),
SyntaxFactory
.
Token
(
SyntaxKind
.
FunctionKeyword
).
WithTriviaFrom
(
subStatement
.
SubOrFunctionKeyword
),
subStatement
.
Identifier
,
subStatement
.
TypeParameterList
,
subStatement
.
ParameterList
.
WithoutTrailingTrivia
(),
subStatement
.
Identifier
.
WithTrailingTrivia
()
,
subStatement
.
TypeParameterList
?
.
WithoutTrailingTrivia
()
,
subStatement
.
ParameterList
?
.
WithoutTrailingTrivia
(),
asClause
,
subStatement
.
HandlesClause
,
subStatement
.
ImplementsClause
)
...
...
src/Features/VisualBasic/Portable/ReplaceMethodWithProperty/VisualBasicReplaceMethodWithPropertyService.vb
浏览文件 @
1102ba50
...
...
@@ -39,8 +39,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.ReplaceMethodWithP
Return
Nothing
End
If
If
position
>
containingMethod
.
ParameterList
.
Span
.
End
Then
Return
Nothing
' Parameter lists in VB are optional and may not be provided.
If
containingMethod
.
ParameterList
Is
Nothing
Then
If
position
>
containingMethod
.
Span
.
End
Then
Return
Nothing
End
If
Else
If
position
>
containingMethod
.
ParameterList
.
Span
.
End
Then
Return
Nothing
End
If
End
If
Return
containingMethod
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录