+ public bool HasOptional()
+ {
+ bool res = false;
+
+ foreach (Parameter p in FixedParameters)
+ {
+ if (p.IsOptional)
+ {
+ res = true;
+ break;
+ }
+ }
+ return (res);
+ }
+
+ /// <summary>
+ /// Returns the number of standard (i.e. non-optional) parameters
+ /// </summary>
+ public int CountStandardParams()
+ {
+ int res = 0;
+ if (FixedParameters == null)
+ return 0;
+
+ foreach (Parameter p in FixedParameters) {
+ if (!p.IsOptional)
+ res++;
+ }
+ return (res);
+ }
+
+ /// <summary>
+ /// Returns the number of optional parameters
+ /// </summary>
+ public int CountOptionalParams()
+ {
+ int res = 0;
+ if (FixedParameters == null)
+ return 0;
+
+ foreach (Parameter p in FixedParameters) {
+ if (p.IsOptional)
+ res++;
+ }
+ return (res);
+ }
+
+ public Expression GetDefaultValue (int i)
+ {
+ Parameter p = FixedParameters[i];
+ if (p.IsOptional)
+ return p.ParameterInitializer;
+ else
+ return null;
+ }
+
+ public void AppendParameter (Parameter p)
+ {
+ if (FixedParameters != null)
+ {
+ Parameter [] pa = new Parameter [FixedParameters.Length+1];
+ FixedParameters.CopyTo (pa, 0);
+ pa[FixedParameters.Length] = p;
+ FixedParameters = pa;
+ }
+ else
+ {
+ FixedParameters = new Parameter [1];
+ FixedParameters[0] = p;
+ }
+ }
+
+ public void PrependParameter (Parameter p)
+ {
+ Parameter [] pa = new Parameter [FixedParameters.Length+1];
+ FixedParameters.CopyTo (pa, 1);
+ pa[0] = p;
+ FixedParameters = pa;
+ }
+
+ public Parameters Copy (Location l)
+ {
+ Parameters p = new Parameters (null, null, l);
+ p.FixedParameters = new Parameter[this.FixedParameters.Length];
+ this.FixedParameters.CopyTo (p.FixedParameters, 0);
+
+ return (p);
+
+ }
+