Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
80a02e9e
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,发现更多精彩内容 >>
提交
80a02e9e
编写于
7月 14, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Consistency
上级
43ebfec0
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
85 addition
and
80 deletion
+85
-80
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AliasSymbolKey.cs
...paces/Core/Portable/SymbolKey/SymbolKey.AliasSymbolKey.cs
+2
-2
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs
...mbolKey/SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AnonymousTypeSymbolKey.cs
...re/Portable/SymbolKey/SymbolKey.AnonymousTypeSymbolKey.cs
+4
-3
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ArrayTypeSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.ArrayTypeSymbolKey.cs
+2
-2
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs
+2
-2
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ErrorTypeSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.ErrorTypeSymbolKey.cs
+5
-4
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.EventSymbolKey.cs
...paces/Core/Portable/SymbolKey/SymbolKey.EventSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.FieldSymbolKey.cs
...paces/Core/Portable/SymbolKey/SymbolKey.FieldSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.FunctionPointerTypeSymbolKey.cs
...table/SymbolKey/SymbolKey.FunctionPointerTypeSymbolKey.cs
+3
-2
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.MethodSymbolKey.cs
...aces/Core/Portable/SymbolKey/SymbolKey.MethodSymbolKey.cs
+6
-6
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ModuleSymbolKey.cs
...aces/Core/Portable/SymbolKey/SymbolKey.ModuleSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.NamedTypeSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.NamedTypeSymbolKey.cs
+4
-4
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.NamespaceSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.NamespaceSymbolKey.cs
+1
-1
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ParameterSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.ParameterSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.PointerTypeSymbolKey.cs
...Core/Portable/SymbolKey/SymbolKey.PointerTypeSymbolKey.cs
+1
-0
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.PropertySymbolKey.cs
...es/Core/Portable/SymbolKey/SymbolKey.PropertySymbolKey.cs
+3
-4
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.TupleTypeSymbolKey.cs
...s/Core/Portable/SymbolKey/SymbolKey.TupleTypeSymbolKey.cs
+46
-50
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.TypeParameterSymbolKey.cs
...re/Portable/SymbolKey/SymbolKey.TypeParameterSymbolKey.cs
+1
-0
未找到文件。
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AliasSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -22,14 +22,14 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
name
=
reader
.
ReadString
();
var
targetResolution
=
reader
.
ReadSymbolKey
(
out
var
targetFailureReason
);
var
filePath
=
reader
.
ReadString
();
if
(
targetFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
AliasSymbolKey
)}
{
nameof
(
targetResolution
)}
failed ->
{
targetFailureReason
}
)"
;
return
default
;
}
var
filePath
=
reader
.
ReadString
();
var
syntaxTree
=
reader
.
GetSyntaxTree
(
filePath
);
if
(
syntaxTree
!=
null
)
{
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -35,6 +35,7 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
isAnonymousDelegateType
=
reader
.
ReadBoolean
();
var
location
=
reader
.
ReadLocation
(
out
var
locationFailureReason
);
if
(
locationFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
AnonymousFunctionOrDelegateSymbolKey
)}
{
nameof
(
location
)}
failed ->
{
locationFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.AnonymousTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -31,15 +31,16 @@ public static void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor)
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
using
var
propertyTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
propertyTypesFailureReason
);
using
var
propertyNames
=
reader
.
ReadStringArray
();
using
var
propertyIsReadOnly
=
reader
.
ReadBooleanArray
();
using
var
propertyLocations
=
reader
.
ReadLocationArray
(
out
var
propertyLocationsFailureReason
);
if
(
propertyTypesFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
AnonymousTypeSymbolKey
)}
{
nameof
(
propertyTypes
)}
failed ->
{
propertyTypesFailureReason
}
)"
;
return
default
;
}
using
var
propertyNames
=
reader
.
ReadStringArray
();
using
var
propertyIsReadOnly
=
reader
.
ReadBooleanArray
();
using
var
propertyLocations
=
reader
.
ReadLocationArray
(
out
var
propertyLocationsFailureReason
);
if
(
propertyLocationsFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
AnonymousTypeSymbolKey
)}
{
nameof
(
propertyLocations
)}
failed ->
{
propertyLocationsFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ArrayTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -17,14 +17,14 @@ public static void Create(IArrayTypeSymbol symbol, SymbolKeyWriter visitor)
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
var
elementTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
elementTypeFailureReason
);
var
rank
=
reader
.
ReadInteger
();
if
(
elementTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
ArrayTypeSymbolKey
)}
{
nameof
(
elementTypeResolution
)}
failed ->
{
elementTypeFailureReason
}
)"
;
return
default
;
}
var
rank
=
reader
.
ReadInteger
();
using
var
result
=
PooledArrayBuilder
<
IArrayTypeSymbol
>.
GetInstance
(
elementTypeResolution
.
SymbolCount
);
foreach
(
var
typeSymbol
in
elementTypeResolution
.
OfType
<
ITypeSymbol
>())
result
.
AddIfNotNull
(
reader
.
Compilation
.
CreateArrayTypeSymbol
(
typeSymbol
,
rank
));
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -123,14 +123,14 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string? fa
var
name
=
reader
.
ReadString
();
var
kind
=
(
SymbolKind
)
reader
.
ReadInteger
();
var
locations
=
reader
.
ReadLocationArray
(
out
var
locationsFailureReason
);
var
ordinal
=
reader
.
ReadInteger
();
if
(
locationsFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
BodyLevelSymbolKey
)}
{
nameof
(
locations
)}
failed ->
{
locationsFailureReason
}
)"
;
return
default
;
}
var
ordinal
=
reader
.
ReadInteger
();
// First check if we can recover the symbol just through the original location.
foreach
(
var
loc
in
locations
)
{
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ErrorTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -62,16 +62,17 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
var
name
=
reader
.
ReadString
();
var
containingSymbolResolution
=
ResolveContainer
(
reader
,
out
var
containingSymbolFailureReason
);
var
arity
=
reader
.
ReadInteger
();
using
var
typeArguments
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
typeArgumentsFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
ErrorTypeSymbolKey
)}
{
nameof
(
containingSymbolResolution
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
return
default
;
}
var
arity
=
reader
.
ReadInteger
();
using
var
typeArguments
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
typeArgumentsFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
if
(
typeArgumentsFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
ErrorTypeSymbolKey
)}
{
nameof
(
typeArguments
)}
failed ->
{
typeArgumentsFailureReason
}
)"
;
return
default
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.EventSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -18,6 +18,7 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
containingTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
containingTypeFailureReason
);
if
(
containingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
EventSymbolKey
)}
{
nameof
(
containingTypeResolution
)}
failed ->
{
containingTypeFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.FieldSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -18,6 +18,7 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
containingTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
containingTypeFailureReason
);
if
(
containingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
FieldSymbolKey
)}
{
nameof
(
containingTypeResolution
)}
failed ->
{
containingTypeFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.FunctionPointerTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -20,14 +20,15 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
returnRefKind
=
reader
.
ReadRefKind
();
var
returnType
=
reader
.
ReadSymbolKey
(
out
var
returnTypeFailureReason
);
using
var
paramRefKinds
=
reader
.
ReadRefKindArray
();
using
var
parameterTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
parameterTypesFailureReason
);
if
(
returnTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
FunctionPointerTypeSymbolKey
)}
{
nameof
(
returnType
)}
failed ->
{
returnTypeFailureReason
}
)"
;
return
default
;
}
using
var
paramRefKinds
=
reader
.
ReadRefKindArray
();
using
var
parameterTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
parameterTypesFailureReason
);
if
(
parameterTypesFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
FunctionPointerTypeSymbolKey
)}
{
nameof
(
parameterTypes
)}
failed ->
{
parameterTypesFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.MethodSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -137,12 +137,6 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
var
metadataName
=
reader
.
ReadString
();
var
containingType
=
reader
.
ReadSymbolKey
(
out
var
containingTypeFailureReason
);
if
(
containingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
MethodSymbolKey
)}
{
nameof
(
containingType
)}
failed ->
{
containingTypeFailureReason
}
)"
;
return
default
;
}
var
arity
=
reader
.
ReadInteger
();
var
isPartialMethodImplementationPart
=
reader
.
ReadBoolean
();
using
var
parameterRefKinds
=
reader
.
ReadRefKindArray
();
...
...
@@ -195,6 +189,12 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
reader
.
PopMethod
(
methodOpt
:
null
);
}
if
(
containingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
MethodSymbolKey
)}
{
nameof
(
containingType
)}
failed ->
{
containingTypeFailureReason
}
)"
;
return
default
;
}
return
CreateResolution
(
result
,
$"(
{
nameof
(
MethodSymbolKey
)}
'
{
metadataName
}
' not found)"
,
out
failureReason
);
}
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ModuleSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -14,6 +14,7 @@ public static void Create(IModuleSymbol symbol, SymbolKeyWriter visitor)
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
var
containingSymbolResolution
=
reader
.
ReadSymbolKey
(
out
var
containingSymbolFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
ModuleSymbolKey
)}
{
nameof
(
containingSymbolResolution
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.NamedTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -31,17 +31,17 @@ public static void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor)
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
var
metadataName
=
reader
.
ReadString
();
var
containingSymbolResolution
=
reader
.
ReadSymbolKey
(
out
var
containingSymbolFailureReason
);
var
arity
=
reader
.
ReadInteger
();
var
isUnboundGenericType
=
reader
.
ReadBoolean
();
using
var
typeArguments
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
typeArgumentsFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
NamedTypeSymbolKey
)}
{
nameof
(
containingSymbolFailureReason
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
return
default
;
}
var
arity
=
reader
.
ReadInteger
();
var
isUnboundGenericType
=
reader
.
ReadBoolean
();
using
var
typeArguments
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
typeArgumentsFailureReason
);
if
(
typeArgumentsFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
NamedTypeSymbolKey
)}
{
nameof
(
typeArguments
)}
failed ->
{
typeArgumentsFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.NamespaceSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -56,8 +56,8 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
isCompilationGlobalNamespace
=
reader
.
ReadBoolean
();
var
containingSymbolResolution
=
reader
.
ReadSymbolKey
(
out
var
containingSymbolFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
EventSymbolKey
)}
{
nameof
(
containingSymbolResolution
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.ParameterSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -20,6 +20,7 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
containingSymbolResolution
=
reader
.
ReadSymbolKey
(
out
var
containingSymbolFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
ParameterSymbolKey
)}
{
nameof
(
containingSymbolResolution
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.PointerTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -14,6 +14,7 @@ public static void Create(IPointerTypeSymbol symbol, SymbolKeyWriter visitor)
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
var
pointedAtTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
pointedAtTypeFailureReason
);
if
(
pointedAtTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
PointerTypeSymbolKey
)}
{
nameof
(
pointedAtTypeResolution
)}
failed ->
{
pointedAtTypeFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.PropertySymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -21,6 +21,9 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
containingTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
containingTypeFailureReason
);
var
isIndexer
=
reader
.
ReadBoolean
();
using
var
refKinds
=
reader
.
ReadRefKindArray
();
using
var
parameterTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
parameterTypesFailureReason
);
if
(
containingTypeFailureReason
!=
null
)
{
...
...
@@ -28,10 +31,6 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
return
default
;
}
var
isIndexer
=
reader
.
ReadBoolean
();
using
var
refKinds
=
reader
.
ReadRefKindArray
();
using
var
parameterTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
parameterTypesFailureReason
);
if
(
parameterTypesFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
PropertySymbolKey
)}
{
nameof
(
parameterTypes
)}
failed ->
{
parameterTypesFailureReason
}
)"
;
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.TupleTypeSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -17,6 +17,8 @@ public static void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor)
{
Debug
.
Assert
(
symbol
.
IsTupleType
);
var
isError
=
symbol
.
TupleUnderlyingType
.
TypeKind
==
TypeKind
.
Error
;
var
friendlyNames
=
ArrayBuilder
<
string
>.
GetInstance
();
var
locations
=
ArrayBuilder
<
Location
>.
GetInstance
();
...
...
@@ -26,12 +28,10 @@ public static void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor)
locations
.
Add
(
FirstOrDefault
(
element
.
Locations
)
??
Location
.
None
);
}
visitor
.
WriteBoolean
(
isError
);
visitor
.
WriteStringArray
(
friendlyNames
.
ToImmutableAndFree
());
visitor
.
WriteLocationArray
(
locations
.
ToImmutableAndFree
());
var
isError
=
symbol
.
TupleUnderlyingType
.
TypeKind
==
TypeKind
.
Error
;
visitor
.
WriteBoolean
(
isError
);
if
(
isError
)
{
var
elementTypes
=
ArrayBuilder
<
ISymbol
>.
GetInstance
();
...
...
@@ -50,68 +50,64 @@ public static void Create(INamedTypeSymbol symbol, SymbolKeyWriter visitor)
}
public
static
SymbolKeyResolution
Resolve
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
var
isError
=
reader
.
ReadBoolean
();
return
isError
?
ResolveErrorTuple
(
reader
,
out
failureReason
)
:
ResolveNormalTuple
(
reader
,
out
failureReason
);
}
private
static
SymbolKeyResolution
ResolveNormalTuple
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
using
var
elementNames
=
reader
.
ReadStringArray
();
var
elementLocations
=
ReadElementLocations
(
reader
,
out
var
elementLocationsFailureReason
);
if
(
elementLocationsFailureReason
!=
null
)
var
underlyingTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
underlyingTypeFailureReason
);
if
(
underlyingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
elementLocations
)}
failed ->
{
elementLocations
FailureReason
}
)"
;
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
underlyingTypeResolution
)}
failed ->
{
underlyingType
FailureReason
}
)"
;
return
default
;
}
var
isError
=
reader
.
ReadBoolean
();
if
(
isError
)
{
using
var
elementTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
elementTypesFailureReason
);
if
(
elementTypesFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
elementTypes
)}
failed ->
{
elementTypesFailureReason
}
)"
;
return
default
;
}
using
var
result
=
PooledArrayBuilder
<
INamedTypeSymbol
>.
GetInstance
();
if
(!
elementTypes
.
IsDefault
)
{
try
{
var
result
=
reader
.
Compilation
.
CreateTupleTypeSymbol
(
elementTypes
.
ToImmutable
(),
elementNames
.
ToImmutable
(),
elementLocations
);
failureReason
=
null
;
return
new
SymbolKeyResolution
(
result
);
}
catch
(
ArgumentException
)
{
}
}
}
else
var
elementNamesArray
=
elementNames
.
ToImmutable
();
foreach
(
var
namedType
in
underlyingTypeResolution
.
OfType
<
INamedTypeSymbol
>())
{
var
underlyingTypeResolution
=
reader
.
ReadSymbolKey
(
out
var
underlyingTypeFailureReason
);
if
(
underlyingTypeFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
underlyingTypeResolution
)}
failed ->
{
underlyingTypeFailureReason
}
)"
;
return
default
;
}
result
.
AddIfNotNull
(
reader
.
Compilation
.
CreateTupleTypeSymbol
(
namedType
,
elementNamesArray
,
elementLocations
));
}
try
{
using
var
result
=
PooledArrayBuilder
<
INamedTypeSymbol
>.
GetInstance
();
return
CreateResolution
(
result
,
$"(
{
nameof
(
TupleTypeSymbolKey
)}
failed)"
,
out
failureReason
);
}
var
elementNamesArray
=
elementNames
.
ToImmutable
();
foreach
(
var
namedType
in
underlyingTypeResolution
.
OfType
<
INamedTypeSymbol
>())
{
result
.
AddIfNotNull
(
reader
.
Compilation
.
CreateTupleTypeSymbol
(
namedType
,
elementNamesArray
,
elementLocations
));
}
private
static
SymbolKeyResolution
ResolveErrorTuple
(
SymbolKeyReader
reader
,
out
string
failureReason
)
{
using
var
elementNames
=
reader
.
ReadStringArray
();
var
elementLocations
=
ReadElementLocations
(
reader
,
out
var
elementLocationsFailureReason
);
using
var
elementTypes
=
reader
.
ReadSymbolKeyArray
<
ITypeSymbol
>(
out
var
elementTypesFailureReason
);
return
CreateResolution
(
result
,
$"(
{
nameof
(
TupleTypeSymbolKey
)}
failed)"
,
out
failureReason
);
}
catch
(
ArgumentException
)
{
}
if
(
elementLocationsFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
elementLocations
)}
failed ->
{
elementLocationsFailureReason
}
)"
;
return
default
;
}
if
(
elementTypesFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
elementTypes
)}
failed ->
{
elementTypesFailureReason
}
)"
;
return
default
;
}
if
(
elementTypes
.
IsDefault
)
{
failureReason
=
$"(
{
nameof
(
TupleTypeSymbolKey
)}
{
nameof
(
elementTypes
)}
failed)"
;
return
default
;
}
var
result
=
reader
.
Compilation
.
CreateTupleTypeSymbol
(
elementTypes
.
ToImmutable
(),
elementNames
.
ToImmutable
(),
elementLocations
);
failureReason
=
null
;
return
new
SymbolKeyResolution
(
re
ader
.
Compilation
.
ObjectType
);
return
new
SymbolKeyResolution
(
re
sult
);
}
private
static
ImmutableArray
<
Location
>
ReadElementLocations
(
SymbolKeyReader
reader
,
out
string
failureReason
)
...
...
src/Workspaces/Core/Portable/SymbolKey/SymbolKey.TypeParameterSymbolKey.cs
浏览文件 @
80a02e9e
...
...
@@ -47,6 +47,7 @@ public static SymbolKeyResolution Resolve(SymbolKeyReader reader, out string fai
{
var
metadataName
=
reader
.
ReadString
();
var
containingSymbolResolution
=
reader
.
ReadSymbolKey
(
out
var
containingSymbolFailureReason
);
if
(
containingSymbolFailureReason
!=
null
)
{
failureReason
=
$"(
{
nameof
(
TypeParameterSymbolKey
)}
{
nameof
(
containingSymbolResolution
)}
failed ->
{
containingSymbolFailureReason
}
)"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录