[mcs] eval.cs: add ValueModificationHandler delegate to be more clear
authorAaron Bockover <abock@xamarin.com>
Mon, 14 Jul 2014 20:24:31 +0000 (16:24 -0400)
committerAaron Bockover <abock@xamarin.com>
Mon, 14 Jul 2014 20:25:02 +0000 (16:25 -0400)
mcs/mcs/eval.cs

index 115429e3f874488644b7d2ae1c32226778fdf81a..0c951b5376fae3bded9b6d339336465a2a19019d 100644 (file)
@@ -24,6 +24,11 @@ using System.Linq;
 namespace Mono.CSharp
 {
 
+       /// <summary>
+       /// Experimental!
+       /// </summary>
+       public delegate void ValueModificationHandler (string variableName, int row, int column, object value);
+
        /// <summary>
        ///   Evaluator: provides an API to evaluate C# statements and
        ///   expressions dynamically.
@@ -309,6 +314,8 @@ namespace Mono.CSharp
                        if (type.IsStructOrEnum)
                                ec.Emit (OpCodes.Box, type);
 
+                       Console.WriteLine ("EMIT: {0} => {1},{2}", name, loc.Row, loc.Column);
+
                        ec.EmitInt (loc.Row);
                        ec.EmitInt (loc.Column);
                        ec.Emit (OpCodes.Ldstr, name);
@@ -479,8 +486,10 @@ namespace Mono.CSharp
                        return result;
                }
 
-               // Experimental
-               public Action<string, int, int, object> ModificationListener { get; set; }
+               /// <summary>
+               /// Experimental!
+               /// </summary>
+               public ValueModificationHandler ModificationListener { get; set; }
 
                enum InputKind {
                        EOF,
@@ -1295,11 +1304,11 @@ namespace Mono.CSharp
 
        static class ListenerProxy
        {
-               static readonly Dictionary<int, Action<string, int, int, object>> listeners = new Dictionary<int, Action<string, int, int, object>> (); 
+               static readonly Dictionary<int, ValueModificationHandler> listeners = new Dictionary<int, ValueModificationHandler> ();
 
                static int counter;
 
-               public static int Register (Action<string, int, int, object> listener)
+               public static int Register (ValueModificationHandler listener)
                {
                        lock (listeners) {
                                var id = counter++;
@@ -1317,7 +1326,7 @@ namespace Mono.CSharp
 
                public static void ValueChanged (object value, int row, int col, string name, int listenerId)
                {
-                       Action<string, int, int, object> action;
+                       ValueModificationHandler action;
                        lock (listeners) {
                                if (!listeners.TryGetValue (listenerId, out action))
                                        return;