/// <summary>Determines if there are any missing parameters.</summary>
        public void GetMissingParameters(DocRange genericErrorRange, OverloadError messageHandler, DeltinScriptParser.Call_parametersContext context, DocRange functionCallRange)
        {
            for (int i = 0; i < OrderedParameters.Length; i++)
            {
                if (OrderedParameters[i]?.Value == null)
                {
                    if (OrderedParameters[i] == null)
                    {
                        OrderedParameters[i] = new PickyParameter(true);
                    }
                    AddContextualParameter(context, functionCallRange, i);

                    // Default value
                    if (Option.Parameters[i].DefaultValue != null)
                    {
                        // Set the default value.
                        OrderedParameters[i].Value = Option.Parameters[i].DefaultValue;
                    }
                    else
                    {
                        // Parameter is missing.
                        Error(string.Format(messageHandler.MissingParameter, Option.Parameters[i].Name), genericErrorRange);
                    }
                }
            }
        }
 public OverloadChooser(IOverload[] overloads, ParseInfo parseInfo, Scope elementScope, Scope getter, DocRange targetRange, DocRange callRange, DocRange fullRange, OverloadError errorMessages)
 {
     _overloads     = overloads;
     _parseInfo     = parseInfo;
     _scope         = elementScope;
     _getter        = getter;
     _targetRange   = targetRange;
     CallRange      = callRange;
     _fullRange     = fullRange;
     _errorMessages = errorMessages;
     parseInfo.Script.AddOverloadData(this);
 }
        public OverloadChooser(IParameterCallable[] overloads, ParseInfo parseInfo, Scope elementScope, Scope getter, DocRange genericErrorRange, DocRange callRange, OverloadError errorMessages)
        {
            AllOverloads = overloads
                           .OrderBy(overload => overload.Parameters.Length)
                           .ToArray();
            CurrentOptions         = AllOverloads.ToList();
            this.parseInfo         = parseInfo;
            this.scope             = elementScope;
            this.getter            = getter;
            this.genericErrorRange = genericErrorRange;
            CallRange          = callRange;
            this.ErrorMessages = errorMessages;

            parseInfo.Script.AddOverloadData(this);
        }