Change the way how using declarators statements are generated to handle await in...
[mono.git] / mcs / mcs / parameter.cs
index 49dffa9372d6fd96d2fe5c5d807eb89fde18e7f0..20fbfb1f2deb9ceb0c93f8d248a6cd21d98a63bf 100644 (file)
@@ -613,40 +613,20 @@ namespace Mono.CSharp {
 
                public void Emit (EmitContext ec)
                {
-                       int arg_idx = idx;
-                       if (!ec.IsStatic)
-                               arg_idx++;
-
-                       ParameterReference.EmitLdArg (ec, arg_idx);
+                       ec.EmitArgumentLoad (idx);
                }
 
                public void EmitAssign (EmitContext ec)
                {
-                       int arg_idx = idx;
-                       if (!ec.IsStatic)
-                               arg_idx++;
-
-                       if (arg_idx <= 255)
-                               ec.Emit (OpCodes.Starg_S, (byte) arg_idx);
-                       else
-                               ec.Emit (OpCodes.Starg, arg_idx);
+                       ec.EmitArgumentStore (idx);
                }
 
                public void EmitAddressOf (EmitContext ec)
                {
-                       int arg_idx = idx;
-
-                       if (!ec.IsStatic)
-                               arg_idx++;
-
-                       bool is_ref = (ModFlags & Modifier.ISBYREF) != 0;
-                       if (is_ref) {
-                               ParameterReference.EmitLdArg (ec, arg_idx);
+                       if ((ModFlags & Modifier.ISBYREF) != 0) {
+                               ec.EmitArgumentLoad (idx);
                        } else {
-                               if (arg_idx <= 255)
-                                       ec.Emit (OpCodes.Ldarga_S, (byte) arg_idx);
-                               else
-                                       ec.Emit (OpCodes.Ldarga, arg_idx);
+                               ec.EmitArgumentAddress (idx);
                        }
                }