Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
cefaf1bf
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,发现更多精彩内容 >>
提交
cefaf1bf
编写于
1月 14, 2016
作者:
N
Neal Gafter
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7514 from drognanar/vbtoplevelsemanticmodel
Merge TopLevel and MethodBody speculative models
上级
d701aad8
d810f30c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
28 deletion
+12
-28
src/Compilers/VisualBasic/Portable/Binding/MethodBodySemanticModel.vb
...s/VisualBasic/Portable/Binding/MethodBodySemanticModel.vb
+1
-25
src/Compilers/VisualBasic/Portable/Compilation/SyntaxTreeSemanticModel.vb
...sualBasic/Portable/Compilation/SyntaxTreeSemanticModel.vb
+2
-3
src/EditorFeatures/VisualBasicTest/Diagnostics/SimplifyTypeNames/SimplifyTypeNamesTests.vb
...t/Diagnostics/SimplifyTypeNames/SimplifyTypeNamesTests.vb
+9
-0
未找到文件。
src/Compilers/VisualBasic/Portable/Binding/MethodBodySemanticModel.vb
浏览文件 @
cefaf1bf
...
...
@@ -16,7 +16,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' <summary>
''' Creates an MethodBodySemanticModel that allows asking semantic questions about an attribute node.
''' </summary>
Friend
Shared
Function
Create
(
binder
As
Method
BodyBinder
,
Optional
ignoreAccessibility
As
Boolean
=
False
)
As
MethodBodySemanticModel
Friend
Shared
Function
Create
(
binder
As
SubOrFunction
BodyBinder
,
Optional
ignoreAccessibility
As
Boolean
=
False
)
As
MethodBodySemanticModel
Return
New
MethodBodySemanticModel
(
binder
.
Root
,
binder
,
ignoreAccessibility
:
=
ignoreAccessibility
)
End
Function
...
...
@@ -86,30 +86,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
False
End
Function
End
Class
' TODO (tomat): merge with MethodBodySemanticModel? C# doesn't have a separate class for top-level. Should it?
Friend
NotInheritable
Class
TopLevelCodeSemanticModel
Inherits
MemberSemanticModel
Public
Sub
New
(
binder
As
TopLevelCodeBinder
,
Optional
ignoreAccessibility
As
Boolean
=
False
)
MyBase
.
New
(
binder
.
Root
,
binder
,
parentSemanticModelOpt
:
=
Nothing
,
speculatedPosition
:
=
0
,
ignoreAccessibility
:
=
ignoreAccessibility
)
End
Sub
Friend
Overrides
Function
TryGetSpeculativeSemanticModelForMethodBodyCore
(
parentModel
As
SyntaxTreeSemanticModel
,
position
As
Integer
,
method
As
MethodBlockBaseSyntax
,
<
Out
>
ByRef
speculativeModel
As
SemanticModel
)
As
Boolean
speculativeModel
=
Nothing
Return
False
End
Function
Friend
Overrides
Function
TryGetSpeculativeSemanticModelCore
(
parentModel
As
SyntaxTreeSemanticModel
,
position
As
Integer
,
statement
As
ExecutableStatementSyntax
,
<
Out
>
ByRef
speculativeModel
As
SemanticModel
)
As
Boolean
speculativeModel
=
Nothing
Return
False
End
Function
Friend
Overrides
Function
TryGetSpeculativeSemanticModelCore
(
parentModel
As
SyntaxTreeSemanticModel
,
position
As
Integer
,
initializer
As
EqualsValueSyntax
,
<
Out
>
ByRef
speculativeModel
As
SemanticModel
)
As
Boolean
speculativeModel
=
Nothing
Return
False
End
Function
End
Class
End
Namespace
src/Compilers/VisualBasic/Portable/Compilation/SyntaxTreeSemanticModel.vb
浏览文件 @
cefaf1bf
...
...
@@ -134,10 +134,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
' PERF: These shared variables avoid repeated allocation of Func(Of Binder, MemberSemanticModel) in GetMemberSemanticModel
Private
Shared
ReadOnly
s_methodBodySemanticModelCreator
As
Func
(
Of
Tuple
(
Of
Binder
,
Boolean
),
MemberSemanticModel
)
=
Function
(
key
As
Tuple
(
Of
Binder
,
Boolean
))
MethodBodySemanticModel
.
Create
(
DirectCast
(
key
.
Item1
,
Method
BodyBinder
),
key
.
Item2
)
Private
Shared
ReadOnly
s_methodBodySemanticModelCreator
As
Func
(
Of
Tuple
(
Of
Binder
,
Boolean
),
MemberSemanticModel
)
=
Function
(
key
As
Tuple
(
Of
Binder
,
Boolean
))
MethodBodySemanticModel
.
Create
(
DirectCast
(
key
.
Item1
,
SubOrFunction
BodyBinder
),
key
.
Item2
)
Private
Shared
ReadOnly
s_initializerSemanticModelCreator
As
Func
(
Of
Tuple
(
Of
Binder
,
Boolean
),
MemberSemanticModel
)
=
Function
(
key
As
Tuple
(
Of
Binder
,
Boolean
))
InitializerSemanticModel
.
Create
(
DirectCast
(
key
.
Item1
,
DeclarationInitializerBinder
),
key
.
Item2
)
Private
Shared
ReadOnly
s_attributeSemanticModelCreator
As
Func
(
Of
Tuple
(
Of
Binder
,
Boolean
),
MemberSemanticModel
)
=
Function
(
key
As
Tuple
(
Of
Binder
,
Boolean
))
AttributeSemanticModel
.
Create
(
DirectCast
(
key
.
Item1
,
AttributeBinder
),
key
.
Item2
)
Private
Shared
ReadOnly
s_topLevelCodeSemanticModelCreator
As
Func
(
Of
Tuple
(
Of
Binder
,
Boolean
),
MemberSemanticModel
)
=
Function
(
key
As
Tuple
(
Of
Binder
,
Boolean
))
New
TopLevelCodeSemanticModel
(
DirectCast
(
key
.
Item1
,
TopLevelCodeBinder
),
key
.
Item2
)
Public
Function
GetMemberSemanticModel
(
binder
As
Binder
)
As
MemberSemanticModel
...
...
@@ -154,7 +153,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
If
If
TypeOf
binder
Is
TopLevelCodeBinder
Then
Return
_semanticModelCache
.
GetOrAdd
(
Tuple
.
Create
(
binder
,
IgnoresAccessibility
),
s_
topLevelCode
SemanticModelCreator
)
Return
_semanticModelCache
.
GetOrAdd
(
Tuple
.
Create
(
binder
,
IgnoresAccessibility
),
s_
methodBody
SemanticModelCreator
)
End
If
Return
Nothing
...
...
src/EditorFeatures/VisualBasicTest/Diagnostics/SimplifyTypeNames/SimplifyTypeNamesTests.vb
浏览文件 @
cefaf1bf
...
...
@@ -345,6 +345,15 @@ index:=1)
index
:
=
0
)
End
Function
<
WpfFact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsSimplifyTypeNames
)
>
Public
Async
Function
TestSimplifyTypeInScriptCode
()
As
Task
Await
TestAsync
(
NewLines
(
"Imports System \n [|System.Console.WriteLine(0)|]"
),
NewLines
(
"Imports System \n Console.WriteLine(0)"
),
parseOptions
:
=
TestOptions
.
Script
,
index
:
=
0
)
End
Function
<
WorkItem
(
542093
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsSimplifyTypeNames
)
>
Public
Async
Function
TestNoSimplificationOfParenthesizedPredefinedTypes
()
As
Task
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录