Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
740c2294
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,发现更多精彩内容 >>
提交
740c2294
编写于
9月 19, 2017
作者:
V
vsadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PR feedback
上级
dd55afd6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
16 deletion
+60
-16
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
+2
-2
src/Compilers/CSharp/Portable/CSharpResources.resx
src/Compilers/CSharp/Portable/CSharpResources.resx
+1
-1
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
+2
-2
src/Compilers/CSharp/Portable/Errors/MessageID.cs
src/Compilers/CSharp/Portable/Errors/MessageID.cs
+2
-2
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
+2
-2
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
...p/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
+29
-6
src/Compilers/CSharp/Test/Semantic/Semantics/BindingAwaitTests.cs
...ilers/CSharp/Test/Semantic/Semantics/BindingAwaitTests.cs
+22
-1
未找到文件。
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
浏览文件 @
740c2294
...
...
@@ -10606,9 +10606,9 @@ internal static string ERR_RefReturnParameter
/// <summary>
/// Looks up a localized string similar to readonly references.
/// </summary>
internal static string IDS_FeatureRead
o
nlyReferences {
internal static string IDS_FeatureRead
O
nlyReferences {
get {
return ResourceManager.GetString("IDS_FeatureRead
o
nlyReferences", resourceCulture);
return ResourceManager.GetString("IDS_FeatureRead
O
nlyReferences", resourceCulture);
}
}
...
...
src/Compilers/CSharp/Portable/CSharpResources.resx
浏览文件 @
740c2294
...
...
@@ -4245,7 +4245,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data
name=
"IDS_FeatureRefLocalsReturns"
xml:space=
"preserve"
>
<value>
byref locals and returns
</value>
</data>
<data
name=
"IDS_FeatureRead
o
nlyReferences"
xml:space=
"preserve"
>
<data
name=
"IDS_FeatureRead
O
nlyReferences"
xml:space=
"preserve"
>
<value>
readonly references
</value>
</data>
<data
name=
"IDS_FeatureRefStructs"
xml:space=
"preserve"
>
...
...
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
浏览文件 @
740c2294
...
...
@@ -1501,7 +1501,7 @@ internal enum ErrorCode
ERR_NamedArgumentSpecificationBeforeFixedArgumentInDynamicInvocation
=
8324
,
#
endregion
diagnostics
introduced
for
C
#
7.2
#
region
diagnostics
introduced
for
`
ref
readonly
`
,
`
ref
ternary
`
and
`
ref
-
like
`
features
in
C
#
7.2
#
region
diagnostics
introduced
for
`
ref
readonly
`
,
`
ref
ternary
`
and
`
ref
-
like
`
features
in
C
#
7.2
ERR_RefConditionalAndAwait
=
8325
,
ERR_RefConditionalNeedsTwoRefs
=
8326
,
ERR_RefConditionalDifferentTypes
=
8327
,
...
...
@@ -1536,6 +1536,6 @@ internal enum ErrorCode
ERR_EscapeLocal
=
8352
,
ERR_EscapeStackAlloc
=
8353
,
ERR_RefReturnThis
=
8354
,
#
endregion
diagnostics
introduced
for
`
ref
readonly
`
,
`
ref
ternary
`
and
`
ref
-
like
`
features
in
C
#
7.2
#
endregion
diagnostics
introduced
for
`
ref
readonly
`
,
`
ref
ternary
`
and
`
ref
-
like
`
features
in
C
#
7.2
}
}
src/Compilers/CSharp/Portable/Errors/MessageID.cs
浏览文件 @
740c2294
...
...
@@ -139,7 +139,7 @@ internal enum MessageID
IDS_FeatureLeadingDigitSeparator
=
MessageBase
+
12723
,
IDS_FeatureNonTrailingNamedArguments
=
MessageBase
+
12724
,
IDS_FeatureRead
o
nlyReferences
=
MessageBase
+
12725
,
IDS_FeatureRead
O
nlyReferences
=
MessageBase
+
12725
,
IDS_FeatureRefStructs
=
MessageBase
+
12726
,
IDS_FeatureReadOnlyStructs
=
MessageBase
+
12727
,
IDS_FeatureRefExtensionMethods
=
MessageBase
+
12728
,
...
...
@@ -203,7 +203,7 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
// C# 7.2 features.
case
MessageID
.
IDS_FeatureNonTrailingNamedArguments
:
// semantic check
case
MessageID
.
IDS_FeatureLeadingDigitSeparator
:
case
MessageID
.
IDS_FeatureRead
o
nlyReferences
:
case
MessageID
.
IDS_FeatureRead
O
nlyReferences
:
case
MessageID
.
IDS_FeatureRefStructs
:
case
MessageID
.
IDS_FeatureReadOnlyStructs
:
case
MessageID
.
IDS_FeatureRefExtensionMethods
:
...
...
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
浏览文件 @
740c2294
...
...
@@ -3900,7 +3900,7 @@ private void ParseParameterModifiers(SyntaxListBuilder modifiers)
// "ref readonly"
if
(
nextKind
==
SyntaxKind
.
ReadOnlyKeyword
)
{
modifier
=
CheckFeatureAvailability
(
modifier
,
MessageID
.
IDS_FeatureRead
o
nlyReferences
);
modifier
=
CheckFeatureAvailability
(
modifier
,
MessageID
.
IDS_FeatureRead
O
nlyReferences
);
nextKind
=
PeekToken
(
1
).
Kind
;
}
...
...
@@ -6156,7 +6156,7 @@ private enum ParseTypeMode
if
(
this
.
CurrentToken
.
Kind
==
SyntaxKind
.
ReadOnlyKeyword
)
{
readonlyKeyword
=
this
.
EatToken
();
readonlyKeyword
=
this
.
CheckFeatureAvailability
(
readonlyKeyword
,
MessageID
.
IDS_FeatureRead
o
nlyReferences
);
readonlyKeyword
=
this
.
CheckFeatureAvailability
(
readonlyKeyword
,
MessageID
.
IDS_FeatureRead
O
nlyReferences
);
}
var
type
=
ParseTypeCore
(
mode
,
expectSizes
);
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
浏览文件 @
740c2294
...
...
@@ -929,8 +929,11 @@ static void Main(string[] args)
var o1 = new C1();
(args != null ? ref o.field : ref o1.field).ToString();
System.Console.Write(o.field.value);
System.Console.WriteLine(o.field.value);
// no copying expected
(args != null ? ref o.field : ref o1.field).RoExtension();
System.Console.Write(o.field.value);
}
}
...
...
@@ -939,7 +942,7 @@ class C1
public readonly S1 field;
}
struct S1
public
struct S1
{
public int value;
...
...
@@ -949,14 +952,22 @@ public override string ToString()
return base.ToString();
}
}
public static class S1Ext
{
public static void RoExtension(ref readonly this S1 self)
{
// do nothing
}
}
"
;
var
comp
=
CompileAndVerify
(
source
,
additionalRefs
:
new
[]
{
SystemRuntimeFacadeRef
,
ValueTupleRef
},
expectedOutput
:
"
0"
,
verify
:
false
);
var
comp
=
CompileAndVerify
(
source
,
additionalRefs
:
new
[]
{
SystemRuntimeFacadeRef
,
ValueTupleRef
,
SystemCoreRef
},
expectedOutput
:
"0
0"
,
verify
:
false
);
comp
.
VerifyDiagnostics
();
comp
.
VerifyIL
(
"Program.Main"
,
@"
{
// Code size
61 (0x3d
)
// Code size
99 (0x63
)
.maxstack 1
.locals init (C1 V_0, //o
C1 V_1, //o1
...
...
@@ -980,8 +991,20 @@ .maxstack 1
IL_002c: ldloc.0
IL_002d: ldflda ""S1 C1.field""
IL_0032: ldfld ""int S1.value""
IL_0037: call ""void System.Console.WriteLine(int)""
IL_003c: ret
IL_0037: call ""void System.Console.Write(int)""
IL_003c: ldarg.0
IL_003d: brtrue.s IL_0047
IL_003f: ldloc.1
IL_0040: ldflda ""S1 C1.field""
IL_0045: br.s IL_004d
IL_0047: ldloc.0
IL_0048: ldflda ""S1 C1.field""
IL_004d: call ""void S1Ext.RoExtension(in S1)""
IL_0052: ldloc.0
IL_0053: ldflda ""S1 C1.field""
IL_0058: ldfld ""int S1.value""
IL_005d: call ""void System.Console.Write(int)""
IL_0062: ret
}
"
);
}
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/BindingAwaitTests.cs
浏览文件 @
740c2294
...
...
@@ -2831,7 +2831,28 @@ static void Main()
// warning CS1685: The predefined type 'ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Diagnostic
(
ErrorCode
.
WRN_MultiplePredefTypes
).
WithArguments
(
"System.Runtime.CompilerServices.ExtensionAttribute"
,
"System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
).
WithLocation
(
1
,
1
));
CompileAndVerify
(
comp
,
expectedOutput
:
"dynamic42"
,
verify
:
false
);
var
compiled
=
CompileAndVerify
(
comp
,
expectedOutput
:
"dynamic42"
,
verify
:
false
);
compiled
.
VerifyIL
(
"MyAwaiter.OnCompleted(System.Action)"
,
@"
{
// Code size 43 (0x2b)
.maxstack 3
.locals init (MyAwaiter.<>c__DisplayClass5_0 V_0) //CS$<>8__locals0
IL_0000: newobj ""MyAwaiter.<>c__DisplayClass5_0..ctor()""
IL_0005: stloc.0
IL_0006: ldloc.0
IL_0007: ldarg.1
IL_0008: stfld ""System.Action MyAwaiter.<>c__DisplayClass5_0.continuation""
IL_000d: ldarg.0
IL_000e: ldflda ""MyTask MyAwaiter.task""
IL_0013: ldfld ""System.Threading.Tasks.Task MyTask.task""
IL_0018: ldloc.0
IL_0019: ldftn ""void MyAwaiter.<>c__DisplayClass5_0.<OnCompleted>b__0(System.Threading.Tasks.Task)""
IL_001f: newobj ""System.Action<System.Threading.Tasks.Task>..ctor(object, System.IntPtr)""
IL_0024: callvirt ""System.Threading.Tasks.Task System.Threading.Tasks.Task.ContinueWith(System.Action<System.Threading.Tasks.Task>)""
IL_0029: pop
IL_002a: ret
}"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录