示例#1
0
        // Returns False if no more parameters can be updated for this unit.
        private bool UpdateSingleDefaultParameter(AnalysisUnit unit, InterpreterScope scope, int index, IParameterInfo info)
        {
            if (index >= FunctionDefinition.ParametersInternal.Length)
            {
                return(false);
            }
            VariableDef param;
            var         name = FunctionDefinition.ParametersInternal[index].Name;

            if (scope.TryGetVariable(name, out param))
            {
                var av = ProjectState.GetAnalysisSetFromObjects(info.ParameterTypes);

                if ((info.IsParamArray && !(param is ListParameterVariableDef)) ||
                    (info.IsKeywordDict && !(param is DictParameterVariableDef)))
                {
                    return(false);
                }

                param.AddTypes(unit, av, true, DeclaringModule);
            }

            return(true);
        }