public void GetLambdaStatement(PortableLambdaType expecting)
        {
            bool found = false;

            _type = expecting;
            foreach (var func in Group.Functions)
            {
                if (func.Parameters.Length == expecting.Parameters.Length)
                {
                    // Make sure the method implements the target lambda.
                    for (int i = 0; i < func.Parameters.Length; i++)
                    {
                        if (!func.Parameters[i].Type.Implements(expecting.Parameters[i]))
                        {
                            continue;
                        }
                    }

                    _chosenFunction = func;
                    found           = true;
                    break;
                }
            }

            // If a compatible function was found, get the handler.
            if (found)
            {
                _functionHandler = GetLambdaHandler(_chosenFunction);
                _identifier      = _parseInfo.TranslateInfo.GetComponent <LambdaGroup>().Add(_functionHandler);

                // Get the variable's invoke info from the parameters.
                InvokedState = new IBridgeInvocable[_functionHandler.ParameterCount()];
                for (int i = 0; i < _functionHandler.ParameterCount(); i++)
                {
                    if (_functionHandler.GetParameterVar(i) is Var var)
                    {
                        InvokedState[i] = var.BridgeInvocable;
                    }
                }
            }
            else
            {
                _parseInfo.Script.Diagnostics.Error("No overload for '" + Group.Name + "' implements " + expecting.GetName(), _range);
            }
        }
 public IIndexReferencer GetParameterVar(int index) => _functionHandler.GetParameterVar(index);