Box* dictItems(BoxedDict* self) { BoxedList* rtn = new BoxedList(); for (const auto& p : self->d) { BoxedTuple::GCVector elts; elts.push_back(p.first); elts.push_back(p.second); BoxedTuple* t = new BoxedTuple(std::move(elts)); listAppendInternal(rtn, t); } return rtn; }
static Box* varnames(Box* b, void*) { RELEASE_ASSERT(b->cls == code_cls, ""); BoxedCode* code = static_cast<BoxedCode*>(b); auto& param_names = code->f->param_names; if (!param_names.takes_param_names) return EmptyTuple; BoxedTuple::GCVector elts; for (auto sr : param_names.args) elts.push_back(boxString(sr)); if (param_names.vararg.size()) elts.push_back(boxString(param_names.vararg)); if (param_names.kwarg.size()) elts.push_back(boxString(param_names.kwarg)); return BoxedTuple::create(elts.size(), &elts[0]); }