Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f5aa024c
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,发现更多精彩内容 >>
提交
f5aa024c
编写于
7月 05, 2016
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove WellKnownType.Last
上级
0317409e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
34 deletion
+49
-34
src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
...s/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
+2
-2
src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs
...pilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs
+2
-2
src/Compilers/Core/Portable/WellKnownTypes.cs
src/Compilers/Core/Portable/WellKnownTypes.cs
+37
-20
src/Compilers/VisualBasic/Portable/Symbols/WellKnownMembers.vb
...ompilers/VisualBasic/Portable/Symbols/WellKnownMembers.vb
+5
-8
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb
.../Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb
+3
-2
未找到文件。
src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs
浏览文件 @
f5aa024c
...
...
@@ -77,7 +77,7 @@ internal Symbol GetWellKnownTypeMember(WellKnownMember member)
internal
NamedTypeSymbol
GetWellKnownType
(
WellKnownType
type
)
{
Debug
.
Assert
(
type
>=
WellKnownType
.
First
&&
type
<=
WellKnownType
.
Last
&&
type
!=
WellKnownType
.
ExtSentinel
);
Debug
.
Assert
(
type
.
IsValid
()
);
int
index
=
(
int
)
type
-
(
int
)
WellKnownType
.
First
;
if
(
_lazyWellKnownTypes
==
null
||
(
object
)
_lazyWellKnownTypes
[
index
]
==
null
)
...
...
@@ -778,7 +778,7 @@ public WellKnownMembersSignatureComparer(CSharpCompilation compilation)
protected
override
bool
MatchTypeToTypeId
(
TypeSymbol
type
,
int
typeId
)
{
WellKnownType
wellKnownId
=
(
WellKnownType
)
typeId
;
if
(
wellKnownId
>=
WellKnownType
.
First
&&
wellKnownId
<=
WellKnownType
.
Last
)
if
(
wellKnownId
.
IsWellKnownType
()
)
{
return
(
type
==
_compilation
.
GetWellKnownType
(
wellKnownId
));
}
...
...
src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs
浏览文件 @
f5aa024c
...
...
@@ -548,7 +548,7 @@ public void AllWellKnownTypes()
}.
Concat
(
WinRtRefs
).
ToArray
();
var
comp
=
CreateCompilation
(
""
,
refs
);
for
(
var
wkt
=
WellKnownType
.
First
;
wkt
<
=
WellKnownType
.
Last
;
wkt
++)
for
(
var
wkt
=
WellKnownType
.
First
;
wkt
<
WellKnownType
.
NextAvailable
;
wkt
++)
{
switch
(
wkt
)
{
...
...
@@ -572,7 +572,7 @@ public void AllWellKnownTypes()
}
[
Fact
]
public
void
AllWellKnowTypesBeforeCSharp7
()
public
void
AllWellKnow
n
TypesBeforeCSharp7
()
{
foreach
(
var
type
in
new
[]
{
WellKnownType
.
System_Math
,
...
...
src/Compilers/Core/Portable/WellKnownTypes.cs
浏览文件 @
f5aa024c
...
...
@@ -260,8 +260,7 @@ internal enum WellKnownType
System_ValueTuple_T7
,
System_ValueTuple_TRest
,
Available
,
Last
=
Available
-
1
,
NextAvailable
,
}
internal
static
class
WellKnownTypes
...
...
@@ -269,7 +268,7 @@ internal static class WellKnownTypes
/// <summary>
/// Number of well known types in WellKnownType enum
/// </summary>
internal
const
int
Count
=
WellKnownType
.
Last
-
WellKnownType
.
First
+
1
;
internal
const
int
Count
=
WellKnownType
.
NextAvailable
-
WellKnownType
.
First
;
/// <summary>
/// Array of names for types.
...
...
@@ -537,31 +536,49 @@ private static void AssertEnumAndTableInSync()
var
typeId
=
(
WellKnownType
)(
i
+
WellKnownType
.
First
);
string
typeIdName
;
if
(
typeId
==
WellKnownType
.
First
)
switch
(
typeId
)
{
typeIdName
=
"System.Math"
;
case
WellKnownType
.
First
:
typeIdName
=
"System.Math"
;
break
;
case
WellKnownType
.
Microsoft_VisualBasic_CompilerServices_ObjectFlowControl_ForLoopControl
:
typeIdName
=
"Microsoft.VisualBasic.CompilerServices.ObjectFlowControl+ForLoopControl"
;
break
;
case
WellKnownType
.
CSharp7Sentinel
:
typeIdName
=
"System.IFormatProvider"
;
break
;
case
WellKnownType
.
ExtSentinel
:
typeIdName
=
""
;
continue
;
default
:
typeIdName
=
typeId
.
ToString
().
Replace
(
"__"
,
"+"
).
Replace
(
'_'
,
'.'
);
break
;
}
else
if
(
typeId
==
WellKnownType
.
Last
)
{
typeIdName
=
"System.ValueTuple`8"
;
}
else
if
(
typeId
==
WellKnownType
.
ExtSentinel
)
{
Debug
.
Assert
(
name
==
""
);
continue
;
}
else
int
separator
=
name
.
IndexOf
(
'`'
);
if
(
separator
>=
0
)
{
typeIdName
=
typeId
.
ToString
().
Replace
(
"__"
,
"+"
).
Replace
(
'_'
,
'.'
);
// Ignore type parameter qualifier for generic types.
name
=
name
.
Substring
(
0
,
separator
);
typeIdName
=
typeIdName
.
Substring
(
0
,
separator
);
}
Debug
.
Assert
(
name
==
"Microsoft.VisualBasic.CompilerServices.ObjectFlowControl+ForLoopControl"
||
name
.
IndexOf
(
'`'
)
>
0
// a generic type
||
name
==
typeIdName
);
Debug
.
Assert
(
name
==
typeIdName
);
}
Debug
.
Assert
((
int
)
WellKnownType
.
ExtSentinel
==
255
);
Debug
.
Assert
((
int
)
WellKnownType
.
Last
<
512
);
Debug
.
Assert
((
int
)
WellKnownType
.
NextAvailable
<=
512
);
}
public
static
bool
IsWellKnownType
(
this
WellKnownType
typeId
)
{
Debug
.
Assert
(
typeId
!=
WellKnownType
.
ExtSentinel
);
return
typeId
>=
WellKnownType
.
First
&&
typeId
<
WellKnownType
.
NextAvailable
;
}
public
static
bool
IsValid
(
this
WellKnownType
typeId
)
{
return
typeId
>=
WellKnownType
.
First
&&
typeId
<
WellKnownType
.
NextAvailable
&&
typeId
!=
WellKnownType
.
ExtSentinel
;
}
public
static
string
GetMetadataName
(
this
WellKnownType
id
)
...
...
src/Compilers/VisualBasic/Portable/Symbols/WellKnownMembers.vb
浏览文件 @
f5aa024c
...
...
@@ -341,7 +341,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
Friend
Function
GetWellKnownType
(
type
As
WellKnownType
)
As
NamedTypeSymbol
Debug
.
Assert
(
type
>=
WellKnownType
.
First
AndAlso
type
<=
WellKnownType
.
Last
AndAlso
type
<>
WellKnownType
.
ExtSentinel
)
Debug
.
Assert
(
type
.
IsWellKnownType
()
)
Dim
index
As
Integer
=
type
-
WellKnownType
.
First
If
_lazyWellKnownTypes
Is
Nothing
OrElse
_lazyWellKnownTypes
(
index
)
Is
Nothing
Then
...
...
@@ -639,15 +639,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Sub
Protected
Overrides
Function
MatchTypeToTypeId
(
type
As
TypeSymbol
,
typeId
As
Integer
)
As
Boolean
Dim
result
As
Boolean
=
False
If
typeId
>=
WellKnownType
.
First
AndAlso
typeId
<=
WellKnownType
.
Last
Then
result
=
(
type
Is
_compilation
.
GetWellKnownType
(
CType
(
typeId
,
WellKnownType
)))
Else
result
=
MyBase
.
MatchTypeToTypeId
(
type
,
typeId
)
Dim
wellKnownId
=
CType
(
typeId
,
WellKnownType
)
If
wellKnownId
.
IsWellKnownType
()
Then
Return
type
Is
_compilation
.
GetWellKnownType
(
wellKnownId
)
End
If
Return
result
Return
MyBase
.
MatchTypeToTypeId
(
type
,
typeId
)
End
Function
End
Class
End
Class
...
...
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb
浏览文件 @
f5aa024c
...
...
@@ -493,8 +493,9 @@ End Namespace
ValueTupleRef
}.
Concat
(
WinRtRefs
).
ToArray
()
Dim
lastType
=
CType
(
WellKnownType
.
NextAvailable
-
1
,
WellKnownType
)
Dim
comp
=
CreateCompilationWithReferences
((
<
compilation
/>
),
refs
.
Concat
(
MsvbRef_v4_0_30319_17929
).
ToArray
())
For
wkt
=
WellKnownType
.
First
To
WellKnownType
.
Last
For
wkt
=
WellKnownType
.
First
To
lastType
Select
Case
wkt
Case
WellKnownType
.
Microsoft_VisualBasic_CompilerServices_EmbeddedOperators
' Only present when embedding VB Core.
...
...
@@ -514,7 +515,7 @@ End Namespace
Next
comp
=
CreateCompilationWithReferences
(
<
compilation
/>
,
refs
,
TestOptions
.
ReleaseDll
.
WithEmbedVbCoreRuntime
(
True
))
For
wkt
=
WellKnownType
.
First
To
WellKnownType
.
Last
For
wkt
=
WellKnownType
.
First
To
lastType
Select
Case
wkt
Case
WellKnownType
.
Microsoft_VisualBasic_CallType
,
WellKnownType
.
Microsoft_VisualBasic_CompilerServices_Operators
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录