diff options
author | Thomas Lively <tlively@google.com> | 2023-09-22 10:37:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 10:37:33 -0700 |
commit | 7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c (patch) | |
tree | cc7da749e2c8e816b6da548267430320a3771171 /src/parser/contexts.h | |
parent | c290aadaf6c08a35311fc6fcaee557bbd66968e4 (diff) | |
download | binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.tar.gz binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.tar.bz2 binaryen-7d4d502500bfd22a0a4e9c1762b1bddccbe14c1c.zip |
Support function contexts in IRBuilder (#5967)
Add a `visitFunctionStart` function to IRBuilder and make it responsible for
setting the function's body when the context is closed. This will simplify
outlining, will be necessary to support branches to function scope properly, and
removes an extra block around function bodies in the new wat parser.
Diffstat (limited to 'src/parser/contexts.h')
-rw-r--r-- | src/parser/contexts.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h index f2aeb2489..7eedcccc2 100644 --- a/src/parser/contexts.h +++ b/src/parser/contexts.h @@ -816,9 +816,10 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> { IRBuilder irBuilder; - void setFunction(Function* func) { + Result<> visitFunctionStart(Function* func) { this->func = func; - irBuilder.setFunction(func); + CHECK_ERR(irBuilder.visitFunctionStart(func)); + return Ok{}; } ParseDefsCtx(std::string_view in, |