Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
cbe2b9fe
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,发现更多精彩内容 >>
提交
cbe2b9fe
编写于
6月 30, 2016
作者:
V
VSadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reduced the size of Microsoft.CodeAnalysis.CSharp.Conversion
上级
ea54e1e1
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
224 addition
and
127 deletion
+224
-127
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
+2
-1
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+6
-1
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/Conversion.cs
...Sharp/Portable/Binder/Semantics/Conversions/Conversion.cs
+205
-109
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/Conversions.cs
...harp/Portable/Binder/Semantics/Conversions/Conversions.cs
+5
-5
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
.../Portable/Binder/Semantics/Conversions/ConversionsBase.cs
+4
-4
src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs
src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs
+0
-5
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
...rtable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
...mpilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
浏览文件 @
cbe2b9fe
...
@@ -363,13 +363,14 @@ private BoundExpression CreateTupleLiteralConversion(CSharpSyntaxNode syntax, Bo
...
@@ -363,13 +363,14 @@ private BoundExpression CreateTupleLiteralConversion(CSharpSyntaxNode syntax, Bo
ImmutableArray
<
TypeSymbol
>
targetElementTypes
=
targetType
.
GetElementTypesOfTupleOrCompatible
();
ImmutableArray
<
TypeSymbol
>
targetElementTypes
=
targetType
.
GetElementTypesOfTupleOrCompatible
();
Debug
.
Assert
(
targetElementTypes
.
Length
==
arguments
.
Length
,
"converting a tuple literal to incompatible type?"
);
Debug
.
Assert
(
targetElementTypes
.
Length
==
arguments
.
Length
,
"converting a tuple literal to incompatible type?"
);
var
underlyingConversions
=
conversionWithoutNullable
.
UnderlyingConversions
;
for
(
int
i
=
0
;
i
<
arguments
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
arguments
.
Length
;
i
++)
{
{
var
argument
=
arguments
[
i
];
var
argument
=
arguments
[
i
];
var
destType
=
targetElementTypes
[
i
];
var
destType
=
targetElementTypes
[
i
];
var
elementConversion
=
underlyingConversions
[
i
];
Conversion
elementConversion
=
conversionWithoutNullable
.
UnderlyingConversions
[
i
];
convertedArguments
.
Add
(
CreateConversion
(
argument
.
Syntax
,
argument
,
elementConversion
,
isCast
,
destType
,
diagnostics
));
convertedArguments
.
Add
(
CreateConversion
(
argument
.
Syntax
,
argument
,
elementConversion
,
isCast
,
destType
,
diagnostics
));
}
}
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
浏览文件 @
cbe2b9fe
...
@@ -6177,7 +6177,12 @@ private BoundExpression TryImplicitConversionToArrayIndex(BoundExpression expr,
...
@@ -6177,7 +6177,12 @@ private BoundExpression TryImplicitConversionToArrayIndex(BoundExpression expr,
return
null
;
return
null
;
}
}
BoundExpression
result
=
CreateConversion
(
expr
.
Syntax
,
expr
,
conversion
.
WithArrayIndexConversion
(
true
),
isCast
:
false
,
destination
:
type
,
diagnostics
:
attemptDiagnostics
);
// UNDONE: was cast?
if
(
conversion
.
IsDynamic
)
{
conversion
=
conversion
.
SetArrayIndexConversionForDynamic
();
}
BoundExpression
result
=
CreateConversion
(
expr
.
Syntax
,
expr
,
conversion
,
isCast
:
false
,
destination
:
type
,
diagnostics
:
attemptDiagnostics
);
// UNDONE: was cast?
Debug
.
Assert
(
result
!=
null
);
// If this ever fails (it shouldn't), then put a null-check around the diagnostics update.
Debug
.
Assert
(
result
!=
null
);
// If this ever fails (it shouldn't), then put a null-check around the diagnostics update.
diagnostics
.
AddRange
(
attemptDiagnostics
);
diagnostics
.
AddRange
(
attemptDiagnostics
);
...
...
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/Conversion.cs
浏览文件 @
cbe2b9fe
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/Conversions.cs
浏览文件 @
cbe2b9fe
...
@@ -337,7 +337,7 @@ private Conversion ClassifyImplicitTupleLiteralConversion(BoundTupleLiteral sour
...
@@ -337,7 +337,7 @@ private Conversion ClassifyImplicitTupleLiteralConversion(BoundTupleLiteral sour
if
(
underlyingTupleConversion
.
Exists
)
if
(
underlyingTupleConversion
.
Exists
)
{
{
return
new
Conversion
(
ConversionKind
.
ImplicitNullable
,
new
Conversion
[]
{
underlyingTupleConversion
}
);
return
new
Conversion
(
ConversionKind
.
ImplicitNullable
,
ImmutableArray
.
Create
(
underlyingTupleConversion
)
);
}
}
}
}
}
}
...
@@ -356,7 +356,7 @@ private Conversion ClassifyExplicitTupleLiteralConversion(BoundTupleLiteral sour
...
@@ -356,7 +356,7 @@ private Conversion ClassifyExplicitTupleLiteralConversion(BoundTupleLiteral sour
// strip nullable from the destination
// strip nullable from the destination
//
//
// the following should work and it is an ExplicitNullable conversion
// the following should work and it is an ExplicitNullable conversion
// var x = ((byte, string)?)(1,
2
);
// var x = ((byte, string)?)(1,
null
);
if
(
destination
.
Kind
==
SymbolKind
.
NamedType
)
if
(
destination
.
Kind
==
SymbolKind
.
NamedType
)
{
{
var
nt
=
(
NamedTypeSymbol
)
destination
;
var
nt
=
(
NamedTypeSymbol
)
destination
;
...
@@ -366,7 +366,7 @@ private Conversion ClassifyExplicitTupleLiteralConversion(BoundTupleLiteral sour
...
@@ -366,7 +366,7 @@ private Conversion ClassifyExplicitTupleLiteralConversion(BoundTupleLiteral sour
if
(
underlyingTupleConversion
.
Exists
)
if
(
underlyingTupleConversion
.
Exists
)
{
{
return
new
Conversion
(
ConversionKind
.
ExplicitNullable
,
new
Conversion
[]
{
underlyingTupleConversion
}
);
return
new
Conversion
(
ConversionKind
.
ExplicitNullable
,
ImmutableArray
.
Create
(
underlyingTupleConversion
)
);
}
}
}
}
}
}
...
@@ -788,7 +788,7 @@ protected override Conversion GetImplicitTupleLiteralConversion(BoundTupleLitera
...
@@ -788,7 +788,7 @@ protected override Conversion GetImplicitTupleLiteralConversion(BoundTupleLitera
argumentConversions
.
Add
(
result
);
argumentConversions
.
Add
(
result
);
}
}
return
new
Conversion
(
ConversionKind
.
ImplicitTupleLiteral
,
argumentConversions
.
To
Array
AndFree
());
return
new
Conversion
(
ConversionKind
.
ImplicitTupleLiteral
,
argumentConversions
.
To
Immutable
AndFree
());
}
}
protected
override
Conversion
GetExplicitTupleLiteralConversion
(
BoundTupleLiteral
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
protected
override
Conversion
GetExplicitTupleLiteralConversion
(
BoundTupleLiteral
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
...
@@ -822,7 +822,7 @@ protected override Conversion GetExplicitTupleLiteralConversion(BoundTupleLitera
...
@@ -822,7 +822,7 @@ protected override Conversion GetExplicitTupleLiteralConversion(BoundTupleLitera
argumentConversions
.
Add
(
result
);
argumentConversions
.
Add
(
result
);
}
}
return
new
Conversion
(
ConversionKind
.
ExplicitTupleLiteral
,
argumentConversions
.
To
Array
AndFree
());
return
new
Conversion
(
ConversionKind
.
ExplicitTupleLiteral
,
argumentConversions
.
To
Immutable
AndFree
());
}
}
protected
override
Conversion
GetInterpolatedStringConversion
(
BoundInterpolatedString
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
)
protected
override
Conversion
GetInterpolatedStringConversion
(
BoundInterpolatedString
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
)
...
...
src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/ConversionsBase.cs
浏览文件 @
cbe2b9fe
...
@@ -965,7 +965,7 @@ private Conversion ClassifyImplicitNullableConversion(TypeSymbol source, TypeSym
...
@@ -965,7 +965,7 @@ private Conversion ClassifyImplicitNullableConversion(TypeSymbol source, TypeSym
var
tupleConversion
=
ClassifyImplicitTupleConversion
(
unwrappedSource
,
unwrappedDestination
,
ref
useSiteDiagnostics
);
var
tupleConversion
=
ClassifyImplicitTupleConversion
(
unwrappedSource
,
unwrappedDestination
,
ref
useSiteDiagnostics
);
if
(
tupleConversion
.
Exists
)
if
(
tupleConversion
.
Exists
)
{
{
return
new
Conversion
(
ConversionKind
.
ImplicitNullable
,
new
Conversion
[]
{
tupleConversion
}
);
return
new
Conversion
(
ConversionKind
.
ImplicitNullable
,
ImmutableArray
.
Create
(
tupleConversion
)
);
}
}
return
Conversion
.
NoConversion
;
return
Conversion
.
NoConversion
;
...
@@ -996,7 +996,7 @@ private Conversion ClassifyImplicitTupleConversion(TypeSymbol source, TypeSymbol
...
@@ -996,7 +996,7 @@ private Conversion ClassifyImplicitTupleConversion(TypeSymbol source, TypeSymbol
nestedConversions
.
Add
(
conversion
);
nestedConversions
.
Add
(
conversion
);
}
}
return
new
Conversion
(
ConversionKind
.
ImplicitTuple
,
nestedConversions
.
To
Array
AndFree
());
return
new
Conversion
(
ConversionKind
.
ImplicitTuple
,
nestedConversions
.
To
Immutable
AndFree
());
}
}
private
Conversion
ClassifyExplicitTupleConversion
(
TypeSymbol
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
private
Conversion
ClassifyExplicitTupleConversion
(
TypeSymbol
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
...
@@ -1027,7 +1027,7 @@ private Conversion ClassifyExplicitTupleConversion(TypeSymbol source, TypeSymbol
...
@@ -1027,7 +1027,7 @@ private Conversion ClassifyExplicitTupleConversion(TypeSymbol source, TypeSymbol
nestedConversions
.
Add
(
conversion
);
nestedConversions
.
Add
(
conversion
);
}
}
return
new
Conversion
(
ConversionKind
.
ExplicitTuple
,
nestedConversions
.
To
Array
AndFree
());
return
new
Conversion
(
ConversionKind
.
ExplicitTuple
,
nestedConversions
.
To
Immutable
AndFree
());
}
}
private
Conversion
ClassifyExplicitNullableConversion
(
TypeSymbol
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
private
Conversion
ClassifyExplicitNullableConversion
(
TypeSymbol
source
,
TypeSymbol
destination
,
ref
HashSet
<
DiagnosticInfo
>
useSiteDiagnostics
,
bool
forCast
)
...
@@ -1069,7 +1069,7 @@ private Conversion ClassifyExplicitNullableConversion(TypeSymbol source, TypeSym
...
@@ -1069,7 +1069,7 @@ private Conversion ClassifyExplicitNullableConversion(TypeSymbol source, TypeSym
var
tupleConversion
=
ClassifyExplicitTupleConversion
(
unwrappedSource
,
unwrappedDestination
,
ref
useSiteDiagnostics
,
forCast
);
var
tupleConversion
=
ClassifyExplicitTupleConversion
(
unwrappedSource
,
unwrappedDestination
,
ref
useSiteDiagnostics
,
forCast
);
if
(
tupleConversion
.
Exists
)
if
(
tupleConversion
.
Exists
)
{
{
return
new
Conversion
(
ConversionKind
.
ExplicitNullable
,
new
[]
{
tupleConversion
}
);
return
new
Conversion
(
ConversionKind
.
ExplicitNullable
,
ImmutableArray
.
Create
(
tupleConversion
)
);
}
}
if
(
HasExplicitEnumerationConversion
(
unwrappedSource
,
unwrappedDestination
))
if
(
HasExplicitEnumerationConversion
(
unwrappedSource
,
unwrappedDestination
))
...
...
src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs
浏览文件 @
cbe2b9fe
...
@@ -322,11 +322,6 @@ public bool IsExtensionMethod
...
@@ -322,11 +322,6 @@ public bool IsExtensionMethod
get
{
return
this
.
Conversion
.
IsExtensionMethod
;
}
get
{
return
this
.
Conversion
.
IsExtensionMethod
;
}
}
}
public
bool
IsArrayIndex
{
get
{
return
this
.
Conversion
.
IsArrayIndex
;
}
}
public
MethodSymbol
SymbolOpt
public
MethodSymbol
SymbolOpt
{
{
get
{
return
this
.
Conversion
.
Method
;
}
get
{
return
this
.
Conversion
.
Method
;
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
浏览文件 @
cbe2b9fe
...
@@ -1101,7 +1101,7 @@ private BoundExpression MakeLiftedUserDefinedConversionConsequence(BoundCall cal
...
@@ -1101,7 +1101,7 @@ private BoundExpression MakeLiftedUserDefinedConversionConsequence(BoundCall cal
Debug
.
Assert
(!
method
.
ReturnsVoid
);
Debug
.
Assert
(!
method
.
ReturnsVoid
);
Debug
.
Assert
(
method
.
ParameterCount
==
1
);
Debug
.
Assert
(
method
.
ParameterCount
==
1
);
conversion
=
conversion
.
With
ConversionMethod
(
method
);
conversion
=
conversion
.
Set
ConversionMethod
(
method
);
if
(
source
.
IsNullableType
()
&&
target
.
IsNullableType
())
if
(
source
.
IsNullableType
()
&&
target
.
IsNullableType
())
{
{
...
...
src/Compilers/CSharp/Portable/Lowering/MethodToClassRewriter.cs
浏览文件 @
cbe2b9fe
...
@@ -671,7 +671,7 @@ private BoundNode RewriteMethodGroupConversion(BoundConversion conversion)
...
@@ -671,7 +671,7 @@ private BoundNode RewriteMethodGroupConversion(BoundConversion conversion)
var
conversionInfo
=
conversion
.
Conversion
;
var
conversionInfo
=
conversion
.
Conversion
;
if
(
conversionInfo
.
Method
!=
(
object
)
method
)
if
(
conversionInfo
.
Method
!=
(
object
)
method
)
{
{
conversionInfo
=
conversionInfo
.
With
ConversionMethod
(
method
);
conversionInfo
=
conversionInfo
.
Set
ConversionMethod
(
method
);
}
}
return
conversion
.
Update
(
return
conversion
.
Update
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录