avoid constructing TypeList's on-the-fly for ListVal's with fixed types

This commit is contained in:
Vern Paxson 2023-07-13 11:47:14 -07:00
parent 1d5bc841e0
commit 6b0d595dae
3 changed files with 16 additions and 3 deletions

View file

@ -5029,7 +5029,7 @@ bool ListExpr::IsPure() const
ValPtr ListExpr::Eval(Frame* f) const
{
auto v = make_intrusive<ListVal>(TYPE_ANY);
std::vector<ValPtr> evs;
for ( const auto& expr : exprs )
{
@ -5041,10 +5041,10 @@ ValPtr ListExpr::Eval(Frame* f) const
return nullptr;
}
v->Append(std::move(ev));
evs.push_back(std::move(ev));
}
return v;
return make_intrusive<ListVal>(cast_intrusive<TypeList>(type), std::move(evs));
}
TypePtr ListExpr::InitType() const