diff options
author | Marek Safar <marek.safar@gmail.com> | 2014-01-09 14:31:23 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2014-01-09 23:40:09 +0400 |
commit | 57b915d78f47f7248e1180099ceb2d3667449a33 (patch) | |
tree | 08a7e032eb962498411d7ceda1985d6dd49e65ac /mcs/class/dlr | |
parent | 4b0111dac91f63701175e4f6e09ebc9fd5aa4106 (diff) |
[dlr] Better FEATURE_REFEMIT checks
Diffstat (limited to 'mcs/class/dlr')
5 files changed, 20 insertions, 11 deletions
diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs index 5667f889738..4d1c2356733 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs @@ -19,7 +19,9 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.Dynamic.Utils; using System.Reflection; +#if FEATURE_REFEMIT using System.Reflection.Emit; +#endif using System.Threading; using System.Runtime.CompilerServices; @@ -61,9 +63,9 @@ namespace System.Linq.Expressions { _delegateType = delegateType; _tailCall = tailCall; } - +#if FEATURE_REFEMIT internal abstract LambdaExpression Accept(StackSpiller spiller); - +#endif /// <summary> /// Gets the static type of the expression that this <see cref="Expression" /> represents. (Inherited from <see cref="Expression"/>.) /// </summary> @@ -217,11 +219,11 @@ namespace System.Linq.Expressions { protected internal override Expression Accept(ExpressionVisitor visitor) { return visitor.VisitLambda(this); } - +#if FEATURE_REFEMIT internal override LambdaExpression Accept(StackSpiller spiller) { return spiller.Rewrite(this); } - +#endif internal static LambdaExpression Create(Expression body, string name, bool tailCall, ReadOnlyCollection<ParameterExpression> parameters) { return new Expression<TDelegate>(body, name, tailCall, parameters); } diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs index 408ae7d99a4..9a60fa44285 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs @@ -20,7 +20,7 @@ using System.Diagnostics; using System.Dynamic.Utils; using System.Reflection; using System.Runtime.CompilerServices; -using Microsoft.Scripting.Utils; +//using Microsoft.Scripting.Utils; #if !FEATURE_CORE_DLR namespace Microsoft.Scripting.Ast { @@ -207,7 +207,7 @@ namespace System.Linq.Expressions { } ConstructorInfo ci = null; if (!type.IsValueType) { - ci = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, ReflectionUtils.EmptyTypes, null); + ci = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Microsoft.Scripting.Utils.ReflectionUtils.EmptyTypes, null); if (ci == null) { throw Error.TypeMissingDefaultConstructor(type); } diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs index 95dea78f1fe..329928fd80c 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs @@ -24,7 +24,9 @@ using System.Linq.Expressions.Compiler; using System; using System.Collections.Generic; using System.Text; +#if FEATURE_REFEMIT using System.Reflection.Emit; +#endif using System.Diagnostics; using System.Diagnostics.SymbolStore; using System.Reflection; @@ -55,6 +57,7 @@ namespace System.Runtime.CompilerServices { /// <param name="sequencePoint">Debug informaton corresponding to the sequence point.</param> public abstract void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint); +#if FEATURE_REFEMIT internal virtual void MarkSequencePoint(LambdaExpression method, MethodBase methodBase, ILGenerator ilg, DebugInfoExpression sequencePoint) { MarkSequencePoint(method, ilg.ILOffset, sequencePoint); } @@ -62,5 +65,6 @@ namespace System.Runtime.CompilerServices { internal virtual void SetLocalName(LocalBuilder localBuilder, string name) { // nop } +#endif } } diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs index d16f40e4354..a2e5ca0a4c1 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs @@ -16,7 +16,9 @@ using System; using System.Dynamic.Utils; using System.Reflection; +#if FEATURE_REFEMIT using System.Reflection.Emit; +#endif #if !FEATURE_CORE_DLR namespace Microsoft.Scripting.Ast.Compiler { diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs index 78d5226492a..5b219237f66 100644 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs +++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs @@ -15,7 +15,9 @@ using System.Diagnostics; using System.Reflection; +#if FEATURE_REFEMIT using System.Reflection.Emit; +#endif using System.Text; namespace System.Dynamic.Utils { @@ -28,13 +30,12 @@ namespace System.Dynamic.Utils { /// </summary> internal static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType, object target) { Debug.Assert(methodInfo != null && delegateType != null); - +#if FEATURE_REFEMIT var dm = methodInfo as DynamicMethod; - if (dm != null) { + if (dm != null) return dm.CreateDelegate(delegateType, target); - } else { - return Delegate.CreateDelegate(delegateType, target, methodInfo); - } +#endif + return Delegate.CreateDelegate(delegateType, target, methodInfo); } internal static Type GetReturnType(this MethodBase mi) { |