Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
78f341aa
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,发现更多精彩内容 >>
提交
78f341aa
编写于
7月 18, 2016
作者:
V
VSadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implemented CommonCreateTupleTypeSymbol APIs
上级
87ba2772
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
24 deletion
+36
-24
src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb
...isualBasic/Portable/Compilation/VisualBasicCompilation.vb
+8
-2
src/Compilers/VisualBasic/Portable/VBResources.Designer.vb
src/Compilers/VisualBasic/Portable/VBResources.Designer.vb
+0
-9
src/Compilers/VisualBasic/Portable/VBResources.resx
src/Compilers/VisualBasic/Portable/VBResources.resx
+0
-3
src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb
...ualBasic/Test/Semantic/Compilation/CompilationAPITests.vb
+28
-10
未找到文件。
src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb
浏览文件 @
78f341aa
...
...
@@ -2594,11 +2594,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Function
Protected
Overrides
Function
CommonCreateTupleTypeSymbol
(
elementTypes
As
ImmutableArray
(
Of
ITypeSymbol
),
elementNames
As
ImmutableArray
(
Of
String
))
As
INamedTypeSymbol
Throw
New
NotSupportedException
(
VBResources
.
TuplesNotSupported
)
Dim
vbElementTypes
=
elementTypes
.
SelectAsArray
(
Function
(
t
)
t
.
EnsureVbSymbolOrNothing
(
Of
TypeSymbol
)(
NameOf
(
elementTypes
)))
Return
TupleTypeSymbol
.
Create
(
locationOpt
:
=
Nothing
,
elementTypes
:
=
vbElementTypes
,
elementLocations
:
=
Nothing
,
elementNames
:
=
elementNames
,
compilation
:
=
Me
)
End
Function
Protected
Overrides
Function
CommonCreateTupleTypeSymbol
(
underlyingType
As
INamedTypeSymbol
,
elementNames
As
ImmutableArray
(
Of
String
))
As
INamedTypeSymbol
Throw
New
NotSupportedException
(
VBResources
.
TuplesNotSupported
)
Return
TupleTypeSymbol
.
Create
(
locationOpt
:
=
Nothing
,
tupleCompatibleType
:
=
underlyingType
.
EnsureVbSymbolOrNothing
(
Of
NamedTypeSymbol
)(
NameOf
(
underlyingType
)),
elementLocations
:
=
Nothing
,
elementNames
:
=
elementNames
)
End
Function
Protected
Overrides
Function
CommonCreatePointerTypeSymbol
(
elementType
As
ITypeSymbol
)
As
IPointerTypeSymbol
...
...
src/Compilers/VisualBasic/Portable/VBResources.Designer.vb
浏览文件 @
78f341aa
...
...
@@ -12315,15 +12315,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Tuples are not supported in VB..
'''</summary>
Friend ReadOnly Property TuplesNotSupported() As String
Get
Return ResourceManager.GetString("TuplesNotSupported", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type argument cannot be Nothing.
'''</summary>
...
...
src/Compilers/VisualBasic/Portable/VBResources.resx
浏览文件 @
78f341aa
...
...
@@ -5361,9 +5361,6 @@
<data
name=
"ERR_PeWritingFailure"
xml:space=
"preserve"
>
<value>
An error occurred while writing the output file: {0}
</value>
</data>
<data
name=
"TuplesNotSupported"
xml:space=
"preserve"
>
<value>
Tuples are not supported in VB.
</value>
</data>
<data
name=
"ERR_OptionMustBeAbsolutePath"
xml:space=
"preserve"
>
<value>
Option '{0}' must be an absolute path.
</value>
</data>
...
...
src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb
浏览文件 @
78f341aa
...
...
@@ -1206,18 +1206,36 @@ BC2014: the value '_' is invalid for option 'RootNamespace'
Assert
.
Throws
(
Of
NotSupportedException
)(
Function
()
compilation
.
CreatePointerTypeSymbol
(
Nothing
))
End
Sub
<
Fact
()
>
<
CompilerTrait
(
CompilerFeature
.
Tuples
)
>
Public
Sub
TuplesNotSupported2
()
Dim
compilation
=
VisualBasicCompilation
.
Create
(
"HelloWorld"
)
Assert
.
Throws
(
Of
NotSupportedException
)(
Function
()
compilation
.
CreateTupleTypeSymbol
(
New
ImmutableArray
(
Of
ITypeSymbol
),
New
ImmutableArray
(
Of
String
)))
<
Fact
>
Public
Sub
CreateTupleTypeSymbol_NoNames
()
Dim
comp
=
VisualBasicCompilation
.
Create
(
"test"
,
references
:
=
{
MscorlibRef
})
' no ValueTuple
Dim
intType
As
TypeSymbol
=
comp
.
GetSpecialType
(
SpecialType
.
System_Int32
)
Dim
stringType
As
TypeSymbol
=
comp
.
GetSpecialType
(
SpecialType
.
System_String
)
Dim
vt2
=
comp
.
GetWellKnownType
(
WellKnownType
.
System_ValueTuple_T2
).
Construct
(
intType
,
stringType
)
Dim
tupleWithoutNames
=
comp
.
CreateTupleTypeSymbol
(
vt2
,
Nothing
)
Assert
.
True
(
tupleWithoutNames
.
IsTupleType
)
Assert
.
Equal
(
"(System.Int32, System.String)"
,
tupleWithoutNames
.
ToTestDisplayString
())
Assert
.
True
(
tupleWithoutNames
.
TupleElementNames
.
IsDefault
)
Assert
.
Equal
({
"System.Int32"
,
"System.String"
},
tupleWithoutNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
CInt
(
SymbolKind
.
NamedType
),
CInt
(
tupleWithoutNames
.
Kind
))
End
Sub
<
Fact
()
>
<
CompilerTrait
(
CompilerFeature
.
Tuples
)
>
Public
Sub
TuplesNotSupported
()
Dim
compilation
=
VisualBasicCompilation
.
Create
(
"HelloWorld"
)
Assert
.
Throws
(
Of
NotSupportedException
)(
Function
()
compilation
.
CreateTupleTypeSymbol
(
underlyingType
:
=
Nothing
,
elementNames
:
=
New
ImmutableArray
(
Of
String
)))
<
Fact
>
Public
Sub
CreateTupleTypeSymbol_WithNames
()
Dim
comp
=
VisualBasicCompilation
.
Create
(
"test"
,
references
:
=
{
MscorlibRef
})
' no ValueTuple
Dim
intType
As
TypeSymbol
=
comp
.
GetSpecialType
(
SpecialType
.
System_Int32
)
Dim
stringType
As
TypeSymbol
=
comp
.
GetSpecialType
(
SpecialType
.
System_String
)
Dim
vt2
=
comp
.
GetWellKnownType
(
WellKnownType
.
System_ValueTuple_T2
).
Construct
(
intType
,
stringType
)
Dim
tupleWithNames
=
comp
.
CreateTupleTypeSymbol
(
vt2
,
ImmutableArray
.
Create
(
"Alice"
,
"Bob"
))
Assert
.
True
(
tupleWithNames
.
IsTupleType
)
Assert
.
Equal
(
"(Alice As System.Int32, Bob As System.String)"
,
tupleWithNames
.
ToTestDisplayString
())
Assert
.
Equal
({
"Alice"
,
"Bob"
},
tupleWithNames
.
TupleElementNames
)
Assert
.
Equal
({
"System.Int32"
,
"System.String"
},
tupleWithNames
.
TupleElementTypes
.
Select
(
Function
(
t
)
t
.
ToTestDisplayString
()))
Assert
.
Equal
(
SymbolKind
.
NamedType
,
tupleWithNames
.
Kind
)
End
Sub
<
Fact
()
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录