Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
1823fba7
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,发现更多精彩内容 >>
提交
1823fba7
编写于
2月 09, 2016
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ignore synthesized delegates in AnonymousTypeManager.GetAnonymousTypeMap
上级
29ab8cba
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
255 addition
and
57 deletion
+255
-57
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LoweredDynamicOperationFactory.cs
.../Lowering/LocalRewriter/LoweredDynamicOperationFactory.cs
+3
-2
src/Compilers/CSharp/Portable/Symbols/AnonymousTypes/AnonymousTypeManager.Templates.cs
.../Symbols/AnonymousTypes/AnonymousTypeManager.Templates.cs
+19
-39
src/Compilers/CSharp/Portable/Symbols/Synthesized/GeneratedNames.cs
...ers/CSharp/Portable/Symbols/Synthesized/GeneratedNames.cs
+47
-12
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedContainer.cs
...harp/Portable/Symbols/Synthesized/SynthesizedContainer.cs
+0
-1
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedDelegateSymbol.cs
...Portable/Symbols/Synthesized/SynthesizedDelegateSymbol.cs
+4
-1
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
.../Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
+180
-0
src/Compilers/VisualBasic/Portable/Symbols/AnonymousTypes/AnonymousTypeDescriptor.vb
...ortable/Symbols/AnonymousTypes/AnonymousTypeDescriptor.vb
+2
-2
未找到文件。
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LoweredDynamicOperationFactory.cs
浏览文件 @
1823fba7
...
...
@@ -754,8 +754,9 @@ internal FieldSymbol DefineCallSiteStorageSymbol(NamedTypeSymbol containerDefini
}
int
parameterCount
=
delegateSignature
.
Length
-
(
returnsVoid
?
0
:
1
);
return
_factory
.
Compilation
.
AnonymousTypeManager
.
SynthesizeDelegate
(
parameterCount
,
byRefs
,
returnsVoid
).
Construct
(
delegateSignature
);
int
generation
=
_factory
.
CompilationState
.
ModuleBuilderOpt
.
CurrentGenerationOrdinal
;
var
synthesizedType
=
_factory
.
Compilation
.
AnonymousTypeManager
.
SynthesizeDelegate
(
parameterCount
,
byRefs
,
returnsVoid
,
generation
);
return
synthesizedType
.
Construct
(
delegateSignature
);
}
internal
BoundExpression
GetArgumentInfo
(
...
...
src/Compilers/CSharp/Portable/Symbols/AnonymousTypes/AnonymousTypeManager.Templates.cs
浏览文件 @
1823fba7
...
...
@@ -5,11 +5,8 @@
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.Collections
;
using
Microsoft.CodeAnalysis.CSharp.Emit
;
using
Microsoft.CodeAnalysis.CSharp.Symbols
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.CSharp.Symbols
...
...
@@ -37,45 +34,20 @@ private struct SynthesizedDelegateKey : IEquatable<SynthesizedDelegateKey>
{
private
readonly
BitVector
_byRefs
;
private
readonly
ushort
_parameterCount
;
private
readonly
byte
_returnsVoid
;
private
readonly
bool
_returnsVoid
;
private
readonly
int
_generation
;
public
SynthesizedDelegateKey
(
int
parameterCount
,
BitVector
byRefs
,
bool
returnsVoid
)
public
SynthesizedDelegateKey
(
int
parameterCount
,
BitVector
byRefs
,
bool
returnsVoid
,
int
generation
)
{
_parameterCount
=
(
ushort
)
parameterCount
;
_returnsVoid
=
(
byte
)(
returnsVoid
?
1
:
0
);
_returnsVoid
=
returnsVoid
;
_generation
=
generation
;
_byRefs
=
byRefs
;
}
/// <summary>
/// Produces name of the synthesized delegate symbol that encodes the parameter byref-ness and return type of the delegate.
/// The arity is appended via `N suffix since in MetadataName calculation since the delegate is generic.
/// </summary>
public
string
MakeTypeName
()
{
var
pooledBuilder
=
PooledStringBuilder
.
GetInstance
();
pooledBuilder
.
Builder
.
Append
(
_returnsVoid
!=
0
?
"<>A"
:
"<>F"
);
if
(!
_byRefs
.
IsNull
)
{
pooledBuilder
.
Builder
.
Append
(
"{"
);
int
i
=
0
;
foreach
(
int
byRefIndex
in
_byRefs
.
Words
())
{
if
(
i
>
0
)
{
pooledBuilder
.
Builder
.
Append
(
","
);
}
pooledBuilder
.
Builder
.
AppendFormat
(
"{0:x8}"
,
byRefIndex
);
i
++;
}
pooledBuilder
.
Builder
.
Append
(
"}"
);
Debug
.
Assert
(
i
>
0
);
}
return
pooledBuilder
.
ToStringAndFree
();
return
GeneratedNames
.
MakeDynamicCallSiteDelegateName
(
_byRefs
,
_returnsVoid
,
_generation
);
}
public
override
bool
Equals
(
object
obj
)
...
...
@@ -87,12 +59,15 @@ public bool Equals(SynthesizedDelegateKey other)
{
return
_parameterCount
==
other
.
_parameterCount
&&
_returnsVoid
==
other
.
_returnsVoid
&&
_generation
==
other
.
_generation
&&
_byRefs
.
Equals
(
other
.
_byRefs
);
}
public
override
int
GetHashCode
()
{
return
Hash
.
Combine
((
int
)
_parameterCount
,
Hash
.
Combine
((
int
)
_returnsVoid
,
_byRefs
.
GetHashCode
()));
return
Hash
.
Combine
(
Hash
.
Combine
((
int
)
_parameterCount
,
_generation
),
Hash
.
Combine
(
_returnsVoid
.
GetHashCode
(),
_byRefs
.
GetHashCode
()));
}
}
...
...
@@ -182,12 +157,12 @@ private void CheckSourceLocationSeen(AnonymousTypePublicSymbol anonymous)
}
}
internal
SynthesizedDelegateSymbol
SynthesizeDelegate
(
int
parameterCount
,
BitVector
byRefParameters
,
bool
returnsVoid
)
internal
SynthesizedDelegateSymbol
SynthesizeDelegate
(
int
parameterCount
,
BitVector
byRefParameters
,
bool
returnsVoid
,
int
generation
)
{
// parameterCount doesn't include return type
Debug
.
Assert
(
byRefParameters
.
IsNull
||
parameterCount
==
byRefParameters
.
Capacity
);
var
key
=
new
SynthesizedDelegateKey
(
parameterCount
,
byRefParameters
,
returnsVoid
);
var
key
=
new
SynthesizedDelegateKey
(
parameterCount
,
byRefParameters
,
returnsVoid
,
generation
);
SynthesizedDelegateValue
result
;
if
(
this
.
SynthesizedDelegates
.
TryGetValue
(
key
,
out
result
))
...
...
@@ -405,14 +380,19 @@ internal static Microsoft.CodeAnalysis.Emit.AnonymousTypeKey GetAnonymousTypeKey
internal
IReadOnlyDictionary
<
Microsoft
.
CodeAnalysis
.
Emit
.
AnonymousTypeKey
,
Microsoft
.
CodeAnalysis
.
Emit
.
AnonymousTypeValue
>
GetAnonymousTypeMap
()
{
var
result
=
new
Dictionary
<
Microsoft
.
CodeAnalysis
.
Emit
.
AnonymousTypeKey
,
Microsoft
.
CodeAnalysis
.
Emit
.
AnonymousTypeValue
>();
var
templates
=
GetAllCreatedTemplates
();
foreach
(
AnonymousTypeTemplateSymbol
template
in
templates
)
var
templates
=
ArrayBuilder
<
AnonymousTypeTemplateSymbol
>.
GetInstance
();
// Get anonymous types but not synthesized delegates. (Delegate types are
// not reused across generations since reuse would add complexity (such
// as parsing delegate type names from metadata) without a clear benefit.)
GetCreatedAnonymousTypeTemplates
(
templates
);
foreach
(
var
template
in
templates
)
{
var
nameAndIndex
=
template
.
NameAndIndex
;
var
key
=
template
.
GetAnonymousTypeKey
();
var
value
=
new
Microsoft
.
CodeAnalysis
.
Emit
.
AnonymousTypeValue
(
nameAndIndex
.
Name
,
nameAndIndex
.
Index
,
template
);
result
.
Add
(
key
,
value
);
}
templates
.
Free
();
return
result
;
}
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/GeneratedNames.cs
浏览文件 @
1823fba7
...
...
@@ -4,6 +4,7 @@
using
System.Diagnostics
;
using
System.Globalization
;
using
System.Linq
;
using
System.Text
;
using
Microsoft.CodeAnalysis.Collections
;
using
Roslyn.Utilities
;
...
...
@@ -188,12 +189,7 @@ internal static string MakeLambdaCacheFieldName(int methodOrdinal, int generatio
if
(
methodOrdinal
>=
0
)
{
builder
.
Append
(
methodOrdinal
);
if
(
methodGeneration
>
0
)
{
builder
.
Append
(
GenerationSeparator
);
builder
.
Append
(
methodGeneration
);
}
AppendOptionalGeneration
(
builder
,
methodGeneration
);
}
if
(
entityOrdinal
>=
0
)
...
...
@@ -204,18 +200,22 @@ internal static string MakeLambdaCacheFieldName(int methodOrdinal, int generatio
}
builder
.
Append
(
entityOrdinal
);
if
(
entityGeneration
>
0
)
{
builder
.
Append
(
GenerationSeparator
);
builder
.
Append
(
entityGeneration
);
}
AppendOptionalGeneration
(
builder
,
entityGeneration
);
}
}
return
result
.
ToStringAndFree
();
}
private
static
void
AppendOptionalGeneration
(
StringBuilder
builder
,
int
generation
)
{
if
(
generation
>
0
)
{
builder
.
Append
(
GenerationSeparator
);
builder
.
Append
(
generation
);
}
}
internal
static
string
MakeHoistedLocalFieldName
(
SynthesizedLocalKind
kind
,
int
slotIndex
,
string
localNameOpt
=
null
)
{
Debug
.
Assert
((
localNameOpt
!=
null
)
==
(
kind
==
SynthesizedLocalKind
.
UserDefined
));
...
...
@@ -448,6 +448,41 @@ internal static string MakeDynamicCallSiteFieldName(int uniqueId)
return
"<>p__"
+
StringExtensions
.
GetNumeral
(
uniqueId
);
}
/// <summary>
/// Produces name of the synthesized delegate symbol that encodes the parameter byref-ness and return type of the delegate.
/// The arity is appended via `N suffix in MetadataName calculation since the delegate is generic.
/// </summary>
internal
static
string
MakeDynamicCallSiteDelegateName
(
BitVector
byRefs
,
bool
returnsVoid
,
int
generation
)
{
var
pooledBuilder
=
PooledStringBuilder
.
GetInstance
();
var
builder
=
pooledBuilder
.
Builder
;
builder
.
Append
(
returnsVoid
?
"<>A"
:
"<>F"
);
if
(!
byRefs
.
IsNull
)
{
builder
.
Append
(
"{"
);
int
i
=
0
;
foreach
(
int
byRefIndex
in
byRefs
.
Words
())
{
if
(
i
>
0
)
{
builder
.
Append
(
","
);
}
builder
.
AppendFormat
(
"{0:x8}"
,
byRefIndex
);
i
++;
}
builder
.
Append
(
"}"
);
Debug
.
Assert
(
i
>
0
);
}
AppendOptionalGeneration
(
builder
,
generation
);
return
pooledBuilder
.
ToStringAndFree
();
}
internal
static
string
AsyncBuilderFieldName
()
{
// Microsoft.VisualStudio.VIL.VisualStudioHost.AsyncReturnStackFrame depends on this name.
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedContainer.cs
浏览文件 @
1823fba7
...
...
@@ -5,7 +5,6 @@
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
System.Runtime.InteropServices
;
using
Microsoft.CodeAnalysis.CSharp.Emit
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.CSharp.Symbols
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedDelegateSymbol.cs
浏览文件 @
1823fba7
...
...
@@ -8,13 +8,16 @@
namespace
Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// Dynamic call-site delegate, for call-sites that do not
/// match System.Action or System.Func signatures.
/// </summary>
internal
sealed
class
SynthesizedDelegateSymbol
:
SynthesizedContainer
{
private
readonly
NamespaceOrTypeSymbol
_containingSymbol
;
private
readonly
MethodSymbol
_constructor
;
private
readonly
MethodSymbol
_invoke
;
// constructor for dynamic call-site delegate:
public
SynthesizedDelegateSymbol
(
NamespaceOrTypeSymbol
containingSymbol
,
string
name
,
...
...
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
浏览文件 @
1823fba7
...
...
@@ -2850,5 +2850,185 @@ .maxstack 2
diff2
.
VerifyIL
(
"C.F"
,
expectedIL
.
Replace
(
"<<VALUE>>"
,
"2"
));
}
[
WorkItem
(
179990
,
"https://devdiv.visualstudio.com:443/defaultcollection/DevDiv/_workitems/edit/179990"
)]
[
Fact
]
public
void
SynthesizedDelegates
()
{
var
template
=
@"class C
{
static void F(dynamic d, out object x, object y)
<N:0>{
<<CALL>>;
}</N:0>
}"
;
var
source0
=
MarkedSource
(
template
.
Replace
(
"<<CALL>>"
,
"d.F(out x, new { })"
));
var
source1
=
MarkedSource
(
template
.
Replace
(
"<<CALL>>"
,
"d.F(out x, new { y })"
));
var
source2
=
MarkedSource
(
template
.
Replace
(
"<<CALL>>"
,
"d.F(new { y }, out x)"
));
var
compilation0
=
CreateCompilationWithMscorlib
(
source0
.
Tree
,
options
:
ComSafeDebugDll
,
references
:
new
[]
{
SystemCoreRef
,
CSharpRef
});
var
compilation1
=
compilation0
.
WithSource
(
source1
.
Tree
);
var
compilation2
=
compilation1
.
WithSource
(
source2
.
Tree
);
var
v0
=
CompileAndVerify
(
compilation0
);
var
md0
=
ModuleMetadata
.
CreateFromImage
(
v0
.
EmittedAssemblyData
);
var
f0
=
compilation0
.
GetMember
<
MethodSymbol
>(
"C.F"
);
var
f1
=
compilation1
.
GetMember
<
MethodSymbol
>(
"C.F"
);
var
f2
=
compilation2
.
GetMember
<
MethodSymbol
>(
"C.F"
);
var
generation0
=
EmitBaseline
.
CreateInitialBaseline
(
md0
,
v0
.
CreateSymReader
().
GetEncMethodDebugInfo
);
v0
.
VerifyIL
(
"C.F"
,
@"{
// Code size 112 (0x70)
.maxstack 9
IL_0000: nop
IL_0001: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>> C.<>o__0.<>p__0""
IL_0006: brfalse.s IL_000a
IL_0008: br.s IL_0053
IL_000a: ldc.i4 0x100
IL_000f: ldstr ""F""
IL_0014: ldnull
IL_0015: ldtoken ""C""
IL_001a: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_001f: ldc.i4.3
IL_0020: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo""
IL_0025: dup
IL_0026: ldc.i4.0
IL_0027: ldc.i4.0
IL_0028: ldnull
IL_0029: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_002e: stelem.ref
IL_002f: dup
IL_0030: ldc.i4.1
IL_0031: ldc.i4.s 17
IL_0033: ldnull
IL_0034: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0039: stelem.ref
IL_003a: dup
IL_003b: ldc.i4.2
IL_003c: ldc.i4.1
IL_003d: ldnull
IL_003e: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0043: stelem.ref
IL_0044: call ""System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable<System.Type>, System.Type, System.Collections.Generic.IEnumerable<Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)""
IL_0049: call ""System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>> System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_004e: stsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>> C.<>o__0.<>p__0""
IL_0053: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>> C.<>o__0.<>p__0""
IL_0058: ldfld ""<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>> System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>>.Target""
IL_005d: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>> C.<>o__0.<>p__0""
IL_0062: ldarg.0
IL_0063: ldarg.1
IL_0064: newobj ""<>f__AnonymousType0..ctor()""
IL_0069: callvirt ""void <>A{00000004}<System.Runtime.CompilerServices.CallSite, dynamic, object, <empty anonymous type>>.Invoke(System.Runtime.CompilerServices.CallSite, dynamic, ref object, <empty anonymous type>)""
IL_006e: nop
IL_006f: ret
}"
);
var
diff1
=
compilation1
.
EmitDifference
(
generation0
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
f0
,
f1
,
GetSyntaxMapFromMarkers
(
source0
,
source1
),
preserveLocalVariables
:
true
)));
diff1
.
VerifyIL
(
"C.F"
,
@"{
// Code size 113 (0x71)
.maxstack 9
IL_0000: nop
IL_0001: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>> C.<>o__0#1.<>p__0""
IL_0006: brfalse.s IL_000a
IL_0008: br.s IL_0053
IL_000a: ldc.i4 0x100
IL_000f: ldstr ""F""
IL_0014: ldnull
IL_0015: ldtoken ""C""
IL_001a: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_001f: ldc.i4.3
IL_0020: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo""
IL_0025: dup
IL_0026: ldc.i4.0
IL_0027: ldc.i4.0
IL_0028: ldnull
IL_0029: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_002e: stelem.ref
IL_002f: dup
IL_0030: ldc.i4.1
IL_0031: ldc.i4.s 17
IL_0033: ldnull
IL_0034: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0039: stelem.ref
IL_003a: dup
IL_003b: ldc.i4.2
IL_003c: ldc.i4.1
IL_003d: ldnull
IL_003e: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0043: stelem.ref
IL_0044: call ""System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable<System.Type>, System.Type, System.Collections.Generic.IEnumerable<Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)""
IL_0049: call ""System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>> System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_004e: stsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>> C.<>o__0#1.<>p__0""
IL_0053: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>> C.<>o__0#1.<>p__0""
IL_0058: ldfld ""<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>> System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>>.Target""
IL_005d: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>> C.<>o__0#1.<>p__0""
IL_0062: ldarg.0
IL_0063: ldarg.1
IL_0064: ldarg.2
IL_0065: newobj ""<>f__AnonymousType1<object>..ctor(object)""
IL_006a: callvirt ""void <>A{00000004}#1<System.Runtime.CompilerServices.CallSite, dynamic, object, <anonymous type: object y>>.Invoke(System.Runtime.CompilerServices.CallSite, dynamic, ref object, <anonymous type: object y>)""
IL_006f: nop
IL_0070: ret
}"
);
var
diff2
=
compilation2
.
EmitDifference
(
diff1
.
NextGeneration
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
f1
,
f2
,
GetSyntaxMapFromMarkers
(
source1
,
source2
),
preserveLocalVariables
:
true
)));
diff2
.
VerifyIL
(
"C.F"
,
@"{
// Code size 113 (0x71)
.maxstack 9
IL_0000: nop
IL_0001: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>> C.<>o__0#2.<>p__0""
IL_0006: brfalse.s IL_000a
IL_0008: br.s IL_0053
IL_000a: ldc.i4 0x100
IL_000f: ldstr ""F""
IL_0014: ldnull
IL_0015: ldtoken ""C""
IL_001a: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_001f: ldc.i4.3
IL_0020: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo""
IL_0025: dup
IL_0026: ldc.i4.0
IL_0027: ldc.i4.0
IL_0028: ldnull
IL_0029: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_002e: stelem.ref
IL_002f: dup
IL_0030: ldc.i4.1
IL_0031: ldc.i4.1
IL_0032: ldnull
IL_0033: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0038: stelem.ref
IL_0039: dup
IL_003a: ldc.i4.2
IL_003b: ldc.i4.s 17
IL_003d: ldnull
IL_003e: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0043: stelem.ref
IL_0044: call ""System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, string, System.Collections.Generic.IEnumerable<System.Type>, System.Type, System.Collections.Generic.IEnumerable<Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)""
IL_0049: call ""System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>> System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_004e: stsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>> C.<>o__0#2.<>p__0""
IL_0053: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>> C.<>o__0#2.<>p__0""
IL_0058: ldfld ""<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object> System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>>.Target""
IL_005d: ldsfld ""System.Runtime.CompilerServices.CallSite<<>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>> C.<>o__0#2.<>p__0""
IL_0062: ldarg.0
IL_0063: ldarg.2
IL_0064: newobj ""<>f__AnonymousType1<object>..ctor(object)""
IL_0069: ldarg.1
IL_006a: callvirt ""void <>A{00000008}#2<System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, object>.Invoke(System.Runtime.CompilerServices.CallSite, dynamic, <anonymous type: object y>, ref object)""
IL_006f: nop
IL_0070: ret
}"
);
}
}
}
src/Compilers/VisualBasic/Portable/Symbols/AnonymousTypes/AnonymousTypeDescriptor.vb
浏览文件 @
1823fba7
...
...
@@ -15,8 +15,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend
Structure
AnonymousTypeDescriptor
Implements
IEquatable
(
Of
AnonymousTypeDescriptor
)
Public
Shared
ReadOnly
SubReturnParameterName
As
String
=
"Sub"
Public
Shared
ReadOnly
FunctionReturnParameterName
As
String
=
"Function"
Public
Const
SubReturnParameterName
As
String
=
"Sub"
Public
Const
FunctionReturnParameterName
As
String
=
"Function"
Friend
Shared
Function
GetReturnParameterName
(
isFunction
As
Boolean
)
As
String
Return
If
(
isFunction
,
FunctionReturnParameterName
,
SubReturnParameterName
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录