From b22354ce408c06966d1e8dd13a5fa097e0bf51d2 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Wed, 11 Nov 2009 17:24:34 +0000 Subject: [PATCH] 2009-11-11 Marek Safar * CSharpInvokeBinder.cs, CSharpBinder.cs, CSharpInvokeMemberBinder.cs: Convert discarded result expressions. svn path=/trunk/mcs/; revision=145966 --- .../Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs | 10 ++++++++-- .../CSharpInvokeBinder.cs | 2 ++ .../CSharpInvokeMemberBinder.cs | 2 ++ .../Microsoft.CSharp.RuntimeBinder/ChangeLog | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs index 69ef9094e8a..59f6af27265 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs @@ -146,17 +146,23 @@ namespace Microsoft.CSharp.RuntimeBinder return Compiler.Constant.CreateConstant (value.LimitType, null, Compiler.Location.Null); } + bool is_compile_time; + if (info != null) { if ((info.Flags & CSharpArgumentInfoFlags.LiteralConstant) != 0) { InitializeCompiler (null); - return Compiler.Constant.CreateConstant (value.RuntimeType ?? value.LimitType, value.Value, Compiler.Location.Null); + return Compiler.Constant.CreateConstant (value.LimitType, value.Value, Compiler.Location.Null); } if ((info.Flags & CSharpArgumentInfoFlags.IsStaticType) != 0) return new Compiler.TypeExpression ((Type) value.Value, Compiler.Location.Null); + + is_compile_time = (info.Flags & CSharpArgumentInfoFlags.UseCompileTimeType) != 0; + } else { + is_compile_time = false; } - return new Compiler.RuntimeValueExpression (value); + return new Compiler.RuntimeValueExpression (value, is_compile_time); } public static Compiler.Arguments CreateCompilerArguments (IEnumerable info, DynamicMetaObject[] args) diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs index 454ea132acd..3748ba0e5e3 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs @@ -56,6 +56,8 @@ namespace Microsoft.CSharp.RuntimeBinder if ((flags & CSharpBinderFlags.ResultDiscarded) == 0) expr = new Compiler.Cast (new Compiler.TypeExpression (ReturnType, Compiler.Location.Null), expr); + else + expr = new Compiler.DynamicResultCast (ReturnType, expr); var binder = new CSharpBinder (this, expr, errorSuggestion); binder.AddRestrictions (target); diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs index 97df49ca93e..b578e499ea3 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs @@ -77,6 +77,8 @@ namespace Microsoft.CSharp.RuntimeBinder if ((flags & CSharpBinderFlags.ResultDiscarded) == 0) expr = new Compiler.Cast (new Compiler.TypeExpression (ReturnType, Compiler.Location.Null), expr); + else + expr = new Compiler.DynamicResultCast (ReturnType, expr); var binder = new CSharpBinder (this, expr, errorSuggestion); binder.AddRestrictions (target); diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog index 23c66546979..de1dd5e9f84 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ChangeLog @@ -1,3 +1,8 @@ +2009-11-11 Marek Safar + + * CSharpInvokeBinder.cs, CSharpBinder.cs, + CSharpInvokeMemberBinder.cs: Convert discarded result expressions. + 2009-11-04 Marek Safar * CSharpIsEventBinder.cs: Dynamic events implementation. -- 2.25.1