Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
dcb97236
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,发现更多精彩内容 >>
提交
dcb97236
编写于
7月 31, 2014
作者:
C
chandera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a couple of completion bugs. (changeset 1309293)
上级
07740d57
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
12 deletion
+38
-12
Src/Workspaces/VisualBasic/Recommendations/VisualBasicRecommendationService.vb
...Basic/Recommendations/VisualBasicRecommendationService.vb
+38
-12
未找到文件。
Src/Workspaces/VisualBasic/Recommendations/VisualBasicRecommendationService.vb
浏览文件 @
dcb97236
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
System.Collections.Immutable
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.Host
Imports
Microsoft.CodeAnalysis.Host.Mef
...
...
@@ -143,7 +144,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
' MemberAccessExpressionSyntax. Thus, let's do other namespaces and types.
Dim
nameBinding
=
context
.
SemanticModel
.
GetSymbolInfo
(
node
.
Left
,
cancellationToken
)
Dim
symbol
=
TryCast
(
nameBinding
.
Symbol
,
INamespaceOrTypeSymbol
)
If
symbol
Is
Nothing
Then
Dim
couldBeMergedNamepsace
=
CouldBeMergedNamespace
(
nameBinding
)
If
symbol
Is
Nothing
AndAlso
Not
couldBeMergedNamepsace
Then
Return
SpecializedCollections
.
EmptyEnumerable
(
Of
ISymbol
)()
End
If
...
...
@@ -151,8 +153,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
Return
SpecializedCollections
.
EmptyEnumerable
(
Of
ISymbol
)()
End
If
Dim
symbols
=
context
.
SemanticModel
_
Dim
symbols
As
IEnumerable
(
Of
ISymbol
)
If
couldBeMergedNamepsace
Then
symbols
=
nameBinding
.
CandidateSymbols
.
OfType
(
Of
INamespaceSymbol
)()
_
.
SelectMany
(
Function
(
n
)
context
.
SemanticModel
.
LookupNamespacesAndTypes
(
node
.
SpanStart
,
n
))
Else
symbols
=
context
.
SemanticModel
_
.
LookupNamespacesAndTypes
(
position
:
=
node
.
SpanStart
,
container
:
=
symbol
)
End
If
Dim
implementsStatement
=
TryCast
(
node
.
Parent
,
ImplementsStatementSyntax
)
If
implementsStatement
IsNot
Nothing
Then
...
...
@@ -206,7 +214,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
container
=
TryCast
(
leftHandBinding
.
Symbol
.
GetSymbolType
(),
INamespaceOrTypeSymbol
)
End
If
Dim
couldBeMergedNamespace
=
False
If
leftHandBinding
.
Symbol
IsNot
Nothing
Then
Dim
firstSymbol
=
leftHandBinding
.
Symbol
Select
Case
firstSymbol
.
Kind
...
...
@@ -239,10 +250,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
excludeShared
=
False
' need to allow shared members for enums
End
If
ElseIf
container
IsNot
Nothing
Then
' In this case, we don't have any options to set because both instance and shared members
' can be called on instances in VB.
Else
couldBeMergedNamespace
=
VisualBasicRecommendationService
.
CouldBeMergedNamespace
(
leftHandBinding
)
End
If
If
container
Is
Nothing
AndAlso
Not
couldBeMergedNamespace
Then
Return
SpecializedCollections
.
EmptyEnumerable
(
Of
ISymbol
)()
End
If
...
...
@@ -250,13 +262,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
Debug
.
Assert
(
Not
excludeInstance
OrElse
Not
useBaseReferenceAccessibility
)
Dim
position
=
node
.
SpanStart
Dim
symbols
=
If
(
useBaseReferenceAccessibility
,
context
.
SemanticModel
.
LookupBaseMembers
(
position
),
If
(
excludeInstance
,
context
.
SemanticModel
.
LookupStaticMembers
(
position
,
container
),
context
.
SemanticModel
.
LookupSymbols
(
position
,
container
,
includeReducedExtensionMethods
:
=
True
))).
AsEnumerable
()
Dim
symbols
As
IEnumerable
(
Of
ISymbol
)
If
couldBeMergedNamespace
Then
symbols
=
leftHandBinding
.
CandidateSymbols
.
OfType
(
Of
INamespaceSymbol
)
_
.
SelectMany
(
Function
(
n
)
LookupSymbolsInContainer
(
n
,
context
.
SemanticModel
,
position
,
excludeInstance
))
Else
symbols
=
If
(
useBaseReferenceAccessibility
,
context
.
SemanticModel
.
LookupBaseMembers
(
position
),
LookupSymbolsInContainer
(
container
,
context
.
SemanticModel
,
position
,
excludeInstance
)).
AsEnumerable
()
End
If
If
excludeShared
Then
symbols
=
symbols
.
Where
(
Function
(
s
)
Not
s
.
IsShared
)
...
...
@@ -289,6 +304,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Recommendations
Return
symbols
End
Function
Private
Shared
Function
CouldBeMergedNamespace
(
leftHandBinding
As
SymbolInfo
)
As
Boolean
Return
leftHandBinding
.
CandidateSymbols
.
Any
()
AndAlso
leftHandBinding
.
CandidateSymbols
.
All
(
Function
(
s
)
s
.
IsNamespace
())
End
Function
Private
Function
LookupSymbolsInContainer
(
container
As
INamespaceOrTypeSymbol
,
semanticModel
As
SemanticModel
,
position
As
Integer
,
excludeInstance
As
Boolean
)
As
ImmutableArray
(
Of
ISymbol
)
Return
If
(
excludeInstance
,
semanticModel
.
LookupStaticMembers
(
position
,
container
),
semanticModel
.
LookupSymbols
(
position
,
container
,
includeReducedExtensionMethods
:
=
True
))
End
Function
''' <summary>
''' In MemberAccessExpression Contexts, filter out event symbols, except inside AddRemoveHandler Statements
''' Also, filter out any implicitly declared members generated by event declaration or property declaration
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录