提交 0eccaec5 编写于 作者: C Charles Stoner

Merge pull request #9922 from cston/unskip

Include [DynamicAttribute] for captured dynamic variables
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Symbols;
using Roslyn.Utilities; using Roslyn.Utilities;
...@@ -98,5 +98,13 @@ internal override bool IsCapturedFrame ...@@ -98,5 +98,13 @@ internal override bool IsCapturedFrame
return _isThis; return _isThis;
} }
} }
internal override bool SuppressDynamicAttribute
{
get
{
return false;
}
}
} }
} }
...@@ -42,6 +42,11 @@ public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeSymbol type ...@@ -42,6 +42,11 @@ public StateMachineFieldSymbol(NamedTypeSymbol stateMachineType, TypeSymbol type
this.SlotDebugInfo = slotDebugInfo; this.SlotDebugInfo = slotDebugInfo;
} }
internal override bool SuppressDynamicAttribute
{
get { return true; }
}
internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound) internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
{ {
return _type; return _type;
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities; using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols namespace Microsoft.CodeAnalysis.CSharp.Symbols
...@@ -53,6 +49,14 @@ public override ImmutableArray<Location> Locations ...@@ -53,6 +49,14 @@ public override ImmutableArray<Location> Locations
} }
} }
internal override bool SuppressDynamicAttribute
{
get
{
return false;
}
}
internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound) internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
{ {
return _property.Type; return _property.Type;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.CSharp.Emit;
using Roslyn.Utilities; using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols namespace Microsoft.CodeAnalysis.CSharp.Symbols
...@@ -15,6 +14,11 @@ public SynthesizedEnumValueFieldSymbol(SourceNamedTypeSymbol containingEnum) ...@@ -15,6 +14,11 @@ public SynthesizedEnumValueFieldSymbol(SourceNamedTypeSymbol containingEnum)
{ {
} }
internal override bool SuppressDynamicAttribute
{
get { return true; }
}
internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound) internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
{ {
return ((SourceNamedTypeSymbol)ContainingType).EnumUnderlyingType; return ((SourceNamedTypeSymbol)ContainingType).EnumUnderlyingType;
......
...@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Symbols ...@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Symbols
/// <summary> /// <summary>
/// Represents a compiler generated field of given type and name. /// Represents a compiler generated field of given type and name.
/// </summary> /// </summary>
internal class SynthesizedFieldSymbol : SynthesizedFieldSymbolBase internal sealed class SynthesizedFieldSymbol : SynthesizedFieldSymbolBase
{ {
private readonly TypeSymbol _type; private readonly TypeSymbol _type;
...@@ -28,6 +28,11 @@ internal class SynthesizedFieldSymbol : SynthesizedFieldSymbolBase ...@@ -28,6 +28,11 @@ internal class SynthesizedFieldSymbol : SynthesizedFieldSymbolBase
_type = type; _type = type;
} }
internal override bool SuppressDynamicAttribute
{
get { return true; }
}
internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound) internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
{ {
return _type; return _type;
......
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Roslyn.Utilities; using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols namespace Microsoft.CodeAnalysis.CSharp.Symbols
{ {
/// <summary> /// <summary>
/// Represents a compiler generated field. /// Represents a compiler generated field or captured variable.
/// </summary> /// </summary>
internal abstract class SynthesizedFieldSymbolBase : FieldSymbol internal abstract class SynthesizedFieldSymbolBase : FieldSymbol
{ {
...@@ -33,21 +32,27 @@ internal abstract class SynthesizedFieldSymbolBase : FieldSymbol ...@@ -33,21 +32,27 @@ internal abstract class SynthesizedFieldSymbolBase : FieldSymbol
(isStatic ? DeclarationModifiers.Static : DeclarationModifiers.None); (isStatic ? DeclarationModifiers.Static : DeclarationModifiers.None);
} }
internal abstract bool SuppressDynamicAttribute
{
get;
}
internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes) internal override void AddSynthesizedAttributes(ModuleCompilationState compilationState, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{ {
base.AddSynthesizedAttributes(compilationState, ref attributes); base.AddSynthesizedAttributes(compilationState, ref attributes);
// do not emit Dynamic or CompilerGenerated attributes for fields inside compiler generated types:
if (_containingType.IsImplicitlyDeclared)
{
return;
}
CSharpCompilation compilation = this.DeclaringCompilation; CSharpCompilation compilation = this.DeclaringCompilation;
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor)); // do not emit CompilerGenerated attributes for fields inside compiler generated types:
if (!_containingType.IsImplicitlyDeclared)
{
AddSynthesizedAttribute(ref attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
}
if (this.Type.ContainsDynamic() && compilation.HasDynamicEmitAttributes() && compilation.CanEmitBoolean()) if (!this.SuppressDynamicAttribute &&
this.Type.ContainsDynamic() &&
compilation.HasDynamicEmitAttributes() &&
compilation.CanEmitBoolean())
{ {
AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.Type, this.CustomModifiers.Length)); AddSynthesizedAttribute(ref attributes, compilation.SynthesizeDynamicAttribute(this.Type, this.CustomModifiers.Length));
} }
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics; using System.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols namespace Microsoft.CodeAnalysis.CSharp.Symbols
{ {
internal sealed class SynthesizedLambdaCacheFieldSymbol : SynthesizedFieldSymbol, ISynthesizedMethodBodyImplementationSymbol internal sealed class SynthesizedLambdaCacheFieldSymbol : SynthesizedFieldSymbolBase, ISynthesizedMethodBodyImplementationSymbol
{ {
private readonly TypeSymbol _type;
private readonly MethodSymbol _topLevelMethod; private readonly MethodSymbol _topLevelMethod;
public SynthesizedLambdaCacheFieldSymbol(NamedTypeSymbol containingType, TypeSymbol type, string name, MethodSymbol topLevelMethod, bool isReadOnly, bool isStatic) public SynthesizedLambdaCacheFieldSymbol(NamedTypeSymbol containingType, TypeSymbol type, string name, MethodSymbol topLevelMethod, bool isReadOnly, bool isStatic)
: base(containingType, type, name, isPublic: true, isReadOnly: isReadOnly, isStatic: isStatic) : base(containingType, name, isPublic: true, isReadOnly: isReadOnly, isStatic: isStatic)
{ {
Debug.Assert(topLevelMethod != null); Debug.Assert((object)type != null);
Debug.Assert((object)topLevelMethod != null);
_type = type;
_topLevelMethod = topLevelMethod; _topLevelMethod = topLevelMethod;
} }
internal override bool SuppressDynamicAttribute => true;
IMethodSymbol ISynthesizedMethodBodyImplementationSymbol.Method => _topLevelMethod; IMethodSymbol ISynthesizedMethodBodyImplementationSymbol.Method => _topLevelMethod;
// When the containing top-level method body is updated we don't need to attempt to update the cache field // When the containing top-level method body is updated we don't need to attempt to update the cache field
// since a field update is a no-op. // since a field update is a no-op.
bool ISynthesizedMethodBodyImplementationSymbol.HasMethodBodyDependency => false; bool ISynthesizedMethodBodyImplementationSymbol.HasMethodBodyDependency => false;
internal override TypeSymbol GetFieldType(ConsList<FieldSymbol> fieldsBeingBound)
{
return _type;
}
} }
} }
...@@ -1264,5 +1264,94 @@ static void Main() ...@@ -1264,5 +1264,94 @@ static void Main()
// Make sure we emit without errors when System.Boolean is missing. // Make sure we emit without errors when System.Boolean is missing.
CompileAndVerify(comp, verify: false); CompileAndVerify(comp, verify: false);
} }
[Fact]
[WorkItem(7840, "https://github.com/dotnet/roslyn/issues/7840")]
public void DynamicDisplayClassFieldMissingBoolean()
{
var source0 =
@"namespace System
{
public class Object { }
public struct Int32 { }
public class ValueType { }
public class Attribute { }
public struct Void { }
public struct IntPtr { }
public class MulticastDelegate { }
}";
var source1 =
@"delegate void D();
class C
{
static void Main()
{
dynamic x = 1;
D d = () => { dynamic y = x; };
}
}";
var comp = CreateCompilation(source0);
comp.VerifyDiagnostics();
var ref0 = comp.EmitToImageReference();
comp = CreateCompilation(source1, references: new[] { ref0, SystemCoreRef });
comp.VerifyDiagnostics();
// Make sure we emit without errors when System.Boolean is missing.
CompileAndVerify(comp, verify: false);
}
[Fact]
public void BackingField()
{
var source =
@"class C
{
static dynamic[] P { get; set; }
}";
CompileAndVerify(source, additionalRefs: new[] { CSharpRef, SystemCoreRef }, expectedSignatures: new[]
{
Signature(
"C",
"<P>k__BackingField",
".field [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [System.Runtime.CompilerServices.DynamicAttribute(System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument])] private static System.Object[] <P>k__BackingField")
});
}
[Fact]
[WorkItem(1095613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1095613")]
public void DisplayClassField()
{
var source =
@"using System;
class C
{
static void F(dynamic[] a)
{
H(() => G(a));
dynamic d = a;
H(() => G(d));
}
static void G(object a)
{
}
static void H(Action a)
{
}
static void Main()
{
F(new object[0]);
}
}";
CompileAndVerify(source, additionalRefs: new[] { CSharpRef, SystemCoreRef }, expectedSignatures: new[]
{
Signature(
"C+<>c__DisplayClass0_0",
"a",
".field [System.Runtime.CompilerServices.DynamicAttribute(System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument])] public instance System.Object[] a"),
Signature(
"C+<>c__DisplayClass0_0",
"d",
".field [System.Runtime.CompilerServices.DynamicAttribute()] public instance System.Object d")
});
}
} }
} }
...@@ -55,6 +55,7 @@ public class CodeGen_DynamicTests : CSharpTestBase ...@@ -55,6 +55,7 @@ public class CodeGen_DynamicTests : CSharpTestBase
#endregion #endregion
#region C# Runtime and System.Core sources #region C# Runtime and System.Core sources
private const string CSharpBinderTemplate = @" private const string CSharpBinderTemplate = @"
...@@ -642,7 +643,9 @@ public void M1(dynamic d) ...@@ -642,7 +643,9 @@ public void M1(dynamic d)
var displayClass = c.GetMember<NamedTypeSymbol>("<>c__DisplayClass0_0"); var displayClass = c.GetMember<NamedTypeSymbol>("<>c__DisplayClass0_0");
var d = displayClass.GetMember<FieldSymbol>("d"); var d = displayClass.GetMember<FieldSymbol>("d");
Assert.Equal(0, d.GetAttributes().Length); var attributes = d.GetAttributes();
Assert.Equal(1, attributes.Length);
Assert.Equal("System.Runtime.CompilerServices.DynamicAttribute", attributes[0].AttributeClass.ToDisplayString());
}); });
} }
...@@ -1047,7 +1050,7 @@ .maxstack 9 ...@@ -1047,7 +1050,7 @@ .maxstack 9
IL_0069: ldarg.0 IL_0069: ldarg.0
IL_006a: ldfld ""T C.<>c__DisplayClass0_0<T>.a"" IL_006a: ldfld ""T C.<>c__DisplayClass0_0<T>.a""
IL_006f: ldarg.0 IL_006f: ldarg.0
IL_0070: ldfld ""object C.<>c__DisplayClass0_0<T>.b"" IL_0070: ldfld """"
IL_0075: callvirt ""void System.Action<System.Runtime.CompilerServices.CallSite, System.Type, T, object>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, T, object)"" IL_0075: callvirt ""void System.Action<System.Runtime.CompilerServices.CallSite, System.Type, T, object>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, T, object)""
IL_007a: ret IL_007a: ret
} }
...@@ -1130,7 +1133,7 @@ .maxstack 13 ...@@ -1130,7 +1133,7 @@ .maxstack 13
IL_0005: stloc.0 IL_0005: stloc.0
IL_0006: ldloc.0 IL_0006: ldloc.0
IL_0007: newobj ""C..ctor()"" IL_0007: newobj ""C..ctor()""
IL_000c: stfld ""object C.<>c__DisplayClass11_0.dyn"" IL_000c: stfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_0011: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, bool>> C.<>o__11.<>p__2"" IL_0011: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, bool>> C.<>o__11.<>p__2""
IL_0016: brtrue.s IL_0044 IL_0016: brtrue.s IL_0044
IL_0018: ldc.i4.0 IL_0018: ldc.i4.0
...@@ -1198,7 +1201,7 @@ .maxstack 13 ...@@ -1198,7 +1201,7 @@ .maxstack 13
IL_00da: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>>.Target"" IL_00da: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>>.Target""
IL_00df: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__0"" IL_00df: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__0""
IL_00e4: ldloc.0 IL_00e4: ldloc.0
IL_00e5: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_00e5: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_00ea: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)"" IL_00ea: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)""
IL_00ef: ldc.i4.s 123 IL_00ef: ldc.i4.s 123
IL_00f1: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, int, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, int)"" IL_00f1: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, int, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, int)""
...@@ -1234,7 +1237,7 @@ .maxstack 13 ...@@ -1234,7 +1237,7 @@ .maxstack 13
IL_014d: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target"" IL_014d: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target""
IL_0152: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__4"" IL_0152: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__4""
IL_0157: ldloc.0 IL_0157: ldloc.0
IL_0158: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_0158: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_015d: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__3"" IL_015d: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__3""
IL_0162: brtrue.s IL_019e IL_0162: brtrue.s IL_019e
IL_0164: ldc.i4.0 IL_0164: ldc.i4.0
...@@ -1263,7 +1266,7 @@ .maxstack 13 ...@@ -1263,7 +1266,7 @@ .maxstack 13
IL_01a3: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target"" IL_01a3: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target""
IL_01a8: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__3"" IL_01a8: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__3""
IL_01ad: ldloc.0 IL_01ad: ldloc.0
IL_01ae: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_01ae: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_01b3: ldloc.1 IL_01b3: ldloc.1
IL_01b4: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)"" IL_01b4: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)""
IL_01b9: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)"" IL_01b9: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)""
...@@ -1295,7 +1298,7 @@ .maxstack 13 ...@@ -1295,7 +1298,7 @@ .maxstack 13
IL_0204: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target"" IL_0204: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>>.Target""
IL_0209: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__7"" IL_0209: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>> C.<>o__11.<>p__7""
IL_020e: ldloc.0 IL_020e: ldloc.0
IL_020f: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_020f: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_0214: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__6"" IL_0214: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__6""
IL_0219: brtrue.s IL_024b IL_0219: brtrue.s IL_024b
IL_021b: ldc.i4.0 IL_021b: ldc.i4.0
...@@ -1338,7 +1341,7 @@ .maxstack 13 ...@@ -1338,7 +1341,7 @@ .maxstack 13
IL_0295: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>>.Target"" IL_0295: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, object, object> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>>.Target""
IL_029a: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__5"" IL_029a: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__11.<>p__5""
IL_029f: ldloc.0 IL_029f: ldloc.0
IL_02a0: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_02a0: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_02a5: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)"" IL_02a5: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)""
IL_02aa: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)"" IL_02aa: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)""
IL_02af: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)"" IL_02af: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object, object)""
...@@ -1348,7 +1351,7 @@ .maxstack 13 ...@@ -1348,7 +1351,7 @@ .maxstack 13
IL_02bc: newobj ""System.Action..ctor(object, System.IntPtr)"" IL_02bc: newobj ""System.Action..ctor(object, System.IntPtr)""
IL_02c1: stloc.2 IL_02c1: stloc.2
IL_02c2: ldloc.0 IL_02c2: ldloc.0
IL_02c3: ldfld ""object C.<>c__DisplayClass11_0.dyn"" IL_02c3: ldfld ""dynamic C.<>c__DisplayClass11_0.dyn""
IL_02c8: stloc.3 IL_02c8: stloc.3
IL_02c9: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, bool>> C.<>o__11.<>p__14"" IL_02c9: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, bool>> C.<>o__11.<>p__14""
IL_02ce: brtrue.s IL_02ef IL_02ce: brtrue.s IL_02ef
...@@ -8860,11 +8863,10 @@ .maxstack 9 ...@@ -8860,11 +8863,10 @@ .maxstack 9
IL_0055: ldtoken ""C"" IL_0055: ldtoken ""C""
IL_005a: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_005a: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_005f: ldarg.0 IL_005f: ldarg.0
IL_0060: ldfld ""object C.<>c__DisplayClass0_0.x"" IL_0060: ldfld ""dynamic C.<>c__DisplayClass0_0.x""
IL_0065: callvirt ""void System.Action<System.Runtime.CompilerServices.CallSite, System.Type, object>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, object)"" IL_0065: callvirt ""void System.Action<System.Runtime.CompilerServices.CallSite, System.Type, object>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, object)""
IL_006a: ret IL_006a: ret
} }");
");
} }
[Fact] [Fact]
...@@ -14580,7 +14582,7 @@ .maxstack 10 ...@@ -14580,7 +14582,7 @@ .maxstack 10
IL_008e: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__0.<>p__0"" IL_008e: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> C.<>o__0.<>p__0""
IL_0093: ldarg.0 IL_0093: ldarg.0
IL_0094: ldfld ""C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_0.<<Main>b__0>d.<>4__this"" IL_0094: ldfld ""C.<>c__DisplayClass0_0 C.<>c__DisplayClass0_0.<<Main>b__0>d.<>4__this""
IL_0099: ldfld ""object C.<>c__DisplayClass0_0.d"" IL_0099: ldfld ""dynamic C.<>c__DisplayClass0_0.d""
IL_009e: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)"" IL_009e: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)""
IL_00a3: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)"" IL_00a3: callvirt ""object System.Func<System.Runtime.CompilerServices.CallSite, object, object>.Invoke(System.Runtime.CompilerServices.CallSite, object)""
IL_00a8: stloc.2 IL_00a8: stloc.2
......
...@@ -1329,7 +1329,7 @@ .maxstack 9 ...@@ -1329,7 +1329,7 @@ .maxstack 9
} }
[WorkItem(1095613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1095613")] [WorkItem(1095613, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1095613")]
[Fact(Skip = "1095613")] [Fact]
public void HoistedLocalsLoseDynamicAttribute() public void HoistedLocalsLoseDynamicAttribute()
{ {
var source = @" var source = @"
...@@ -1356,114 +1356,89 @@ static void Foo(int x) ...@@ -1356,114 +1356,89 @@ static void Foo(int x)
var result = context.CompileExpression("Foo(x)", out error, testData); var result = context.CompileExpression("Foo(x)", out error, testData);
Assert.Null(error); Assert.Null(error);
VerifyCustomTypeInfo(result, 0x01); VerifyCustomTypeInfo(result, 0x01);
testData.GetMethodData("<>c.<>m0()").VerifyIL(@" testData.GetMethodData("<>x.<>m0").VerifyIL(
{ @"{
// Code size 166 (0xa6) // Code size 103 (0x67)
.maxstack 11 .maxstack 9
.locals init (System.Func<dynamic> V_0) //a .locals init (C.<>c__DisplayClass0_0 V_0, //CS$<>8__locals0
IL_0000: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" System.Func<dynamic> V_1) //a
IL_0005: brtrue.s IL_002b IL_0000: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_0005: brtrue.s IL_0042
IL_0007: ldc.i4.0 IL_0007: ldc.i4.0
IL_0008: ldtoken ""System.Func<dynamic>"" IL_0008: ldstr ""Foo""
IL_000d: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_000d: ldnull
IL_0012: ldtoken ""<>c"" IL_000e: ldtoken ""C""
IL_0017: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_0013: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_001c: call ""System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, System.Type, System.Type)"" IL_0018: ldc.i4.2
IL_0021: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>>.Create(System.Runtime.CompilerServices.CallSiteBinder)"" IL_0019: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo""
IL_0026: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_001e: dup
IL_002b: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_001f: ldc.i4.0
IL_0030: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>>.Target"" IL_0020: ldc.i4.s 33
IL_0035: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_0022: ldnull
IL_003a: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1"" IL_0023: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_003f: brtrue.s IL_007c IL_0028: stelem.ref
IL_0041: ldc.i4.0 IL_0029: dup
IL_0042: ldstr ""Foo"" IL_002a: ldc.i4.1
IL_0047: ldnull IL_002b: ldc.i4.0
IL_0048: ldtoken ""<>c"" IL_002c: ldnull
IL_004d: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_002d: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0052: ldc.i4.2 IL_0032: stelem.ref
IL_0053: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"" IL_0033: 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_0058: dup IL_0038: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_0059: ldc.i4.0 IL_003d: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_005a: ldc.i4.s 33 IL_0042: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_005c: ldnull IL_0047: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Target""
IL_005d: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)"" IL_004c: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_0062: stelem.ref IL_0051: ldtoken ""<>x""
IL_0063: dup IL_0056: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_0064: ldc.i4.1 IL_005b: ldloc.0
IL_0065: ldc.i4.0 IL_005c: ldfld ""dynamic C.<>c__DisplayClass0_0.x""
IL_0066: ldnull IL_0061: callvirt ""dynamic System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, dynamic)""
IL_0067: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)"" IL_0066: ret
IL_006c: stelem.ref
IL_006d: 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_0072: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_0077: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_007c: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_0081: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Target""
IL_0086: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_008b: ldtoken ""<>c""
IL_0090: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_0095: ldsfld ""dynamic C.x""
IL_009a: callvirt ""dynamic System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, dynamic)""
IL_009f: callvirt ""System.Func<dynamic> System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>.Invoke(System.Runtime.CompilerServices.CallSite, dynamic)""
IL_00a4: stloc.0
IL_00a5: ret
}"); }");
testData = new CompilationTestData();
result = context.CompileExpression("Foo(y)", out error, testData); result = context.CompileExpression("Foo(y)", out error, testData);
Assert.Null(error); Assert.Null(error);
VerifyCustomTypeInfo(result, 0x01); VerifyCustomTypeInfo(result, 0x01);
testData.GetMethodData("<>c.<>m0()").VerifyIL(@" testData.GetMethodData("<>x.<>m0").VerifyIL(
{ @"{
// Code size 166 (0xa6) // Code size 103 (0x67)
.maxstack 11 .maxstack 9
.locals init (System.Func<dynamic> V_0) //a .locals init (C.<>c__DisplayClass0_0 V_0, //CS$<>8__locals0
IL_0000: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" System.Func<dynamic> V_1) //a
IL_0005: brtrue.s IL_002b IL_0000: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_0005: brtrue.s IL_0042
IL_0007: ldc.i4.0 IL_0007: ldc.i4.0
IL_0008: ldtoken ""System.Func<dynamic>"" IL_0008: ldstr ""Foo""
IL_000d: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_000d: ldnull
IL_0012: ldtoken ""<>c"" IL_000e: ldtoken ""C""
IL_0017: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_0013: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_001c: call ""System.Runtime.CompilerServices.CallSiteBinder Microsoft.CSharp.RuntimeBinder.Binder.Convert(Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, System.Type, System.Type)"" IL_0018: ldc.i4.2
IL_0021: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>>.Create(System.Runtime.CompilerServices.CallSiteBinder)"" IL_0019: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo""
IL_0026: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_001e: dup
IL_002b: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_001f: ldc.i4.0
IL_0030: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>>.Target"" IL_0020: ldc.i4.s 33
IL_0035: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>> <>c.<<>m0>o__SiteContainer0.<>p__Site2"" IL_0022: ldnull
IL_003a: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1"" IL_0023: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_003f: brtrue.s IL_007c IL_0028: stelem.ref
IL_0041: ldc.i4.0 IL_0029: dup
IL_0042: ldstr ""Foo"" IL_002a: ldc.i4.1
IL_0047: ldnull IL_002b: ldc.i4.0
IL_0048: ldtoken ""<>c"" IL_002c: ldnull
IL_004d: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"" IL_002d: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)""
IL_0052: ldc.i4.2 IL_0032: stelem.ref
IL_0053: newarr ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo"" IL_0033: 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_0058: dup IL_0038: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_0059: ldc.i4.0 IL_003d: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_005a: ldc.i4.s 33 IL_0042: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_005c: ldnull IL_0047: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Target""
IL_005d: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)"" IL_004c: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>x.<>o__0.<>p__0""
IL_0062: stelem.ref IL_0051: ldtoken ""<>x""
IL_0063: dup IL_0056: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_0064: ldc.i4.1 IL_005b: ldloc.0
IL_0065: ldc.i4.0 IL_005c: ldfld ""dynamic C.<>c__DisplayClass0_0.y""
IL_0066: ldnull IL_0061: callvirt ""dynamic System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, dynamic)""
IL_0067: call ""Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create(Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)"" IL_0066: ret
IL_006c: stelem.ref
IL_006d: 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_0072: call ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Create(System.Runtime.CompilerServices.CallSiteBinder)""
IL_0077: stsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_007c: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_0081: ldfld ""System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic> System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>>.Target""
IL_0086: ldsfld ""System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>> <>c.<<>m0>o__SiteContainer0.<>p__Site1""
IL_008b: ldtoken ""<>c""
IL_0090: call ""System.Type System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)""
IL_0095: ldsfld ""dynamic C.x""
IL_009a: callvirt ""dynamic System.Func<System.Runtime.CompilerServices.CallSite, System.Type, dynamic, dynamic>.Invoke(System.Runtime.CompilerServices.CallSite, System.Type, dynamic)""
IL_009f: callvirt ""System.Func<dynamic> System.Func<System.Runtime.CompilerServices.CallSite, dynamic, System.Func<dynamic>>.Invoke(System.Runtime.CompilerServices.CallSite, dynamic)""
IL_00a4: stloc.0
IL_00a5: ret
}"); }");
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册