Fixed symbol table handling in for loop dehydration / rehydration
This handles them using the same pattern used by Block, ensuring that they are popped when we are done with them. Change-Id: Ibffb85e036d623ac9a33221df0688aeebfd8e85b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501017 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
2710bcfc68
commit
bad97bc935
@ -482,11 +482,11 @@ void Dehydrator::write(const Statement* s) {
|
||||
case Statement::Kind::kFor: {
|
||||
const ForStatement& f = s->as<ForStatement>();
|
||||
this->writeCommand(Rehydrator::kFor_Command);
|
||||
AutoDehydratorSymbolTable symbols(this, f.symbols());
|
||||
this->write(f.initializer().get());
|
||||
this->write(f.test().get());
|
||||
this->write(f.next().get());
|
||||
this->write(f.statement().get());
|
||||
this->write(*f.symbols());
|
||||
break;
|
||||
}
|
||||
case Statement::Kind::kIf: {
|
||||
|
@ -343,17 +343,17 @@ std::unique_ptr<Statement> Rehydrator::statement() {
|
||||
return ExpressionStatement::Make(fContext, std::move(expr));
|
||||
}
|
||||
case Rehydrator::kFor_Command: {
|
||||
AutoRehydratorSymbolTable symbols(this);
|
||||
std::unique_ptr<Statement> initializer = this->statement();
|
||||
std::unique_ptr<Expression> test = this->expression();
|
||||
std::unique_ptr<Expression> next = this->expression();
|
||||
std::unique_ptr<Statement> body = this->statement();
|
||||
std::shared_ptr<SymbolTable> symbols = this->symbolTable();
|
||||
std::unique_ptr<LoopUnrollInfo> unrollInfo =
|
||||
Analysis::GetLoopUnrollInfo(/*line=*/-1, initializer.get(), test.get(),
|
||||
next.get(), body.get(), /*errors=*/nullptr);
|
||||
return ForStatement::Make(fContext, /*line=*/-1, std::move(initializer),
|
||||
std::move(test), std::move(next), std::move(body),
|
||||
std::move(unrollInfo), std::move(symbols));
|
||||
std::move(unrollInfo), fSymbolTable);
|
||||
}
|
||||
case Rehydrator::kIf_Command: {
|
||||
bool isStatic = this->readU8();
|
||||
|
Loading…
Reference in New Issue
Block a user