+ public Parameters (Parameter [] parameters, bool has_arglist) :
+ this (parameters)
+ {
+ this.has_arglist = has_arglist;
+ }
+
+ public static Parameters CreateFullyResolved (Parameter p, Type type)
+ {
+ return new Parameters (new Parameter [] { p }, new Type [] { type });
+ }
+
+ public static Parameters CreateFullyResolved (Parameter[] parameters, Type[] types)
+ {
+ return new Parameters (parameters, types);
+ }
+
+ public static Parameters MergeGenerated (Parameters userParams, bool checkConflicts, Parameter compilerParams, Type compilerTypes)
+ {
+ return MergeGenerated (userParams, checkConflicts,
+ new Parameter [] { compilerParams },
+ new Type [] { compilerTypes });
+ }
+
+ //
+ // Use this method when you merge compiler generated parameters with user parameters
+ //
+ public static Parameters MergeGenerated (Parameters userParams, bool checkConflicts, Parameter[] compilerParams, Type[] compilerTypes)
+ {
+ Parameter[] all_params = new Parameter [userParams.Count + compilerParams.Length];
+ userParams.FixedParameters.CopyTo(all_params, 0);
+
+ Type [] all_types;
+ if (userParams.types != null) {
+ all_types = new Type [all_params.Length];
+ userParams.Types.CopyTo (all_types, 0);
+ } else {
+ all_types = null;
+ }
+
+ int last_filled = userParams.Count;
+ int index = 0;
+ foreach (Parameter p in compilerParams) {
+ for (int i = 0; i < last_filled; ++i) {
+ while (p.Name == all_params [i].Name) {
+ if (checkConflicts && i < userParams.Count) {
+ Report.Error (316, userParams [i].Location,
+ "The parameter name `{0}' conflicts with a compiler generated name", p.Name);
+ }
+ p.Name = '_' + p.Name;
+ }
+ }
+ all_params [last_filled] = p;
+ if (all_types != null)
+ all_types [last_filled] = compilerTypes [index++];
+ ++last_filled;