public override object Call(params object[] args) { int nargs = args.Length; object argList = null; object[] outArgs = new object[argNames.Length]; if (nargs < nparams) { if (nargs + defaults.Length < nparams) { throw BadArgumentError(nargs); } for (int i = 0; i < nargs; i++) { outArgs[i] = args[i]; } object[] defs = defaults; int di = defs.Length - 1; for (int i = nparams - 1; i >= nargs; i--) { outArgs[i] = defs[di--]; } } else if (nargs > nparams) { if (argListPos >= 0) { for (int i = 0; i < nparams; i++) { outArgs[i] = args[i]; } object[] extraArgs = new object[nargs - nparams]; for (int i = 0; i < extraArgs.Length; i++) { extraArgs[i] = args[i + nparams]; } argList = Tuple.Make(extraArgs); } else { throw BadArgumentError(nargs); } } else { for (int i = 0; i < nargs; i++) { outArgs[i] = args[i]; } } if (argListPos >= 0) { if (argList == null) { argList = Tuple.MakeTuple(); } outArgs[argListPos] = argList; } if (kwDictPos >= 0) { outArgs[kwDictPos] = new Dict(); //PyDictionary.make(); } if (!EnforceRecursion) { return(target(outArgs)); } PushFrame(); try { return(target(outArgs)); } finally { PopFrame(); } }
public DictWrapperForHashtableDictionary(Dict dictionary) { this.dict = dictionary; }
internal bool TryLookupName(string name, out object?value) => Dict.TryGetValue(name, out value) || ModuleContext.Globals.TryGetValue(name, out value);
public DictWrapperForIDict(Dict dictionary) { this.dict = dictionary; }