Resolver: Traverse expressions without recursion

This CL changes the way that the resolver traverses expressions to avoid stack overflows for deeply nested expressions.

Instead of having the expression resolver methods call back into
Expression(), add a TraverseExpressions() method that collects all the
expression nodes with a simple DFS.

This currently only changes the way that Expressions are traversed. We
may need to do the same for statements.

Bug: chromium:1246375
Change-Id: Ie81905da1b790b6dd1df9f1ac42e06593d397c21
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63700
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2021-09-08 15:18:36 +00:00
committed by Tint LUCI CQ
parent be514a1efb
commit b7bcbf0d20
7 changed files with 200 additions and 86 deletions

View File

@@ -320,6 +320,7 @@ tint_unittests_source_set("tint_unittests_core_src") {
"../src/utils/io/command_test.cc",
"../src/utils/io/tmpfile_test.cc",
"../src/utils/math_test.cc",
"../src/utils/reverse_test.cc",
"../src/utils/scoped_assignment_test.cc",
"../src/utils/unique_vector_test.cc",
"../src/writer/append_vector_test.cc",