fix(3p/nix): inherit Expr from gc, make parser state traceable

The parser contained vectors, and the primary parser state, that
were not participating in GC tracing.

Change-Id: Ie198592cd7acffd390e3e2ae9595138b56416838
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1706
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
Kane York 2020-08-09 22:42:00 -07:00 committed by kanepyork
parent 42bdaacca6
commit 906f5c1d2d
4 changed files with 56 additions and 40 deletions

View file

@ -92,8 +92,7 @@ void addFormal(const Pos& pos, Formals* formals, const Formal& formal) {
formals->argNames.insert(formal.name);
}
Expr* stripIndentation(const Pos& pos, SymbolTable& symbols,
std::vector<Expr*>& es) {
Expr* stripIndentation(const Pos& pos, SymbolTable& symbols, VectorExprs& es) {
if (es.empty()) {
return new ExprString(symbols.Create(""));
}
@ -138,11 +137,11 @@ Expr* stripIndentation(const Pos& pos, SymbolTable& symbols,
}
/* Strip spaces from each line. */
std::vector<Expr*>* es2 = new std::vector<Expr*>;
VectorExprs* es2 = new VectorExprs;
atStartOfLine = true;
size_t curDropped = 0;
size_t n = es.size();
for (std::vector<Expr*>::iterator i = es.begin(); i != es.end(); ++i, --n) {
for (VectorExprs::iterator i = es.begin(); i != es.end(); ++i, --n) {
ExprIndStr* e = dynamic_cast<ExprIndStr*>(*i);
if (!e) {
atStartOfLine = false;