Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5a5ea2a6
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,发现更多精彩内容 >>
提交
5a5ea2a6
编写于
9月 19, 2017
作者:
V
vsadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CR feedback
上级
ca41aeda
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
8 addition
and
32 deletion
+8
-32
src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
+2
-0
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
+0
-14
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
+3
-3
src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocSpanExpressionsTests.cs
...Test/Semantic/Semantics/StackAllocSpanExpressionsTests.cs
+1
-1
src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs
src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs
+1
-7
src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs
...pilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs
+1
-7
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
浏览文件 @
5a5ea2a6
...
...
@@ -1887,6 +1887,7 @@ internal static uint GetValEscape(BoundExpression expr, uint scopeOfTheContainin
case
BoundKind
.
Local
:
return
((
BoundLocal
)
expr
).
LocalSymbol
.
ValEscapeScope
;
case
BoundKind
.
StackAllocArrayCreation
:
case
BoundKind
.
ConvertedStackAllocExpression
:
return
Binder
.
TopLevelScope
;
...
...
@@ -2054,6 +2055,7 @@ internal static bool CheckValEscape(SyntaxNode node, BoundExpression expr, uint
}
return
true
;
case
BoundKind
.
StackAllocArrayCreation
:
case
BoundKind
.
ConvertedStackAllocExpression
:
if
(
escapeTo
<
Binder
.
TopLevelScope
)
{
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
浏览文件 @
5a5ea2a6
...
...
@@ -75,20 +75,6 @@ internal partial class Binder
sourceTuple
.
HasErrors
);
}
// identity stackalloc conversions result in a converted node
// to indicate that stackalloc conversions are no longer applicable.
// nothing else changes
if
(
source
.
Kind
==
BoundKind
.
StackAllocArrayCreation
)
{
var
sourceStackAlloc
=
(
BoundStackAllocArrayCreation
)
source
;
source
=
new
BoundConvertedStackAllocExpression
(
sourceStackAlloc
.
Syntax
,
sourceStackAlloc
.
ElementType
,
sourceStackAlloc
.
Count
,
sourceStackAlloc
.
Type
,
sourceStackAlloc
.
HasErrors
);
}
// We need to preserve any conversion that changes the type (even identity conversions, like object->dynamic),
// or that was explicitly written in code (so that GetSemanticInfo can find the syntax in the bound tree).
if
(!
isCast
&&
source
.
Type
==
destination
)
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
浏览文件 @
5a5ea2a6
...
...
@@ -3016,9 +3016,9 @@ private void BindArrayInitializerExpressions(InitializerExpressionSyntax initial
StackAllocArrayCreationExpressionSyntax
node
,
DiagnosticBag
diagnostics
)
{
bool
hasErrors
=
false
;
var
inLegalPosition
=
(
IsInMethodBody
||
IsLocalFunctionsScopeBinder
)
&&
node
.
IsLegalSpanStackAllocPosition
();
if
(!
IsInMethodBody
&&
!
IsLocalFunctionsScopeBinder
||
!
node
.
IsLegalSpanStackAllocPosition
())
if
(!
inLegalPosition
)
{
hasErrors
=
true
;
diagnostics
.
Add
(
...
...
@@ -3105,7 +3105,7 @@ private void BindArrayInitializerExpressions(InitializerExpressionSyntax initial
}
TypeSymbol
type
=
null
;
if
(!
node
.
IsVariableDeclarationInitialization
())
if
(
inLegalPosition
&&
!
node
.
IsVariableDeclarationInitialization
())
{
CheckFeatureAvailability
(
node
,
MessageID
.
IDS_FeatureRefStructs
,
diagnostics
);
GetWellKnownTypeMember
(
Compilation
,
WellKnownMember
.
System_Span_T__ctor
,
diagnostics
,
syntax
:
node
);
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/StackAllocSpanExpressionsTests.cs
浏览文件 @
5a5ea2a6
...
...
@@ -227,7 +227,7 @@ void M()
}
[
Fact
]
public
void
ConditionalExpressionOnSpan_
NonConvertible
()
public
void
ConditionalExpressionOnSpan_
BothStackallocSpans
()
{
CreateCompilationWithMscorlibAndSpan
(
@"
class Test
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs
浏览文件 @
5a5ea2a6
...
...
@@ -7560,13 +7560,7 @@ void M(int* p = stackalloc int[1])
CreateStandardCompilation
(
text
,
options
:
TestOptions
.
UnsafeReleaseDll
).
VerifyDiagnostics
(
// (4,21): error CS1525: Invalid expression term 'stackalloc'
// void M(int* p = stackalloc int[1])
Diagnostic
(
ErrorCode
.
ERR_InvalidExprTerm
,
"stackalloc"
).
WithArguments
(
"stackalloc"
).
WithLocation
(
4
,
21
),
// (4,21): error CS0656: Missing compiler required member 'System.Span`1..ctor'
// void M(int* p = stackalloc int[1])
Diagnostic
(
ErrorCode
.
ERR_MissingPredefinedMember
,
"stackalloc int[1]"
).
WithArguments
(
"System.Span`1"
,
".ctor"
).
WithLocation
(
4
,
21
),
// (4,21): error CS0518: Predefined type 'System.Span`1' is not defined or imported
// void M(int* p = stackalloc int[1])
Diagnostic
(
ErrorCode
.
ERR_PredefinedTypeNotFound
,
"stackalloc int[1]"
).
WithArguments
(
"System.Span`1"
).
WithLocation
(
4
,
21
)
Diagnostic
(
ErrorCode
.
ERR_InvalidExprTerm
,
"stackalloc"
).
WithArguments
(
"stackalloc"
).
WithLocation
(
4
,
21
)
);
}
...
...
src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs
浏览文件 @
5a5ea2a6
...
...
@@ -2876,13 +2876,7 @@ static void Main(string[] args)
CreateStandardCompilation
(
text
,
options
:
new
CSharpCompilationOptions
(
OutputKind
.
DynamicallyLinkedLibrary
,
allowUnsafe
:
true
)).
VerifyDiagnostics
(
// (4,30): error CS1525: Invalid expression term 'stackalloc'
// int* property { get; } = stackalloc int[256];
Diagnostic
(
ErrorCode
.
ERR_InvalidExprTerm
,
"stackalloc"
).
WithArguments
(
"stackalloc"
).
WithLocation
(
4
,
30
),
// (4,30): error CS0656: Missing compiler required member 'System.Span`1..ctor'
// int* property { get; } = stackalloc int[256];
Diagnostic
(
ErrorCode
.
ERR_MissingPredefinedMember
,
"stackalloc int[256]"
).
WithArguments
(
"System.Span`1"
,
".ctor"
).
WithLocation
(
4
,
30
),
// (4,30): error CS0518: Predefined type 'System.Span`1' is not defined or imported
// int* property { get; } = stackalloc int[256];
Diagnostic
(
ErrorCode
.
ERR_PredefinedTypeNotFound
,
"stackalloc int[256]"
).
WithArguments
(
"System.Span`1"
).
WithLocation
(
4
,
30
)
Diagnostic
(
ErrorCode
.
ERR_InvalidExprTerm
,
"stackalloc"
).
WithArguments
(
"stackalloc"
).
WithLocation
(
4
,
30
)
);
}
[
Fact
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录