diff options
author | Thomas Lively <tlively@google.com> | 2024-09-19 17:07:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 17:07:51 -0700 |
commit | 2711d4fe4b4514ea146e8810959a8f170c932591 (patch) | |
tree | 76f352d5ba9ea963527214f02c87293b9bb3b171 /src/passes/Print.cpp | |
parent | b285448a3f8f06123b5b6048efa4ff3d2a13e0a7 (diff) | |
download | binaryen-2711d4fe4b4514ea146e8810959a8f170c932591.tar.gz binaryen-2711d4fe4b4514ea146e8810959a8f170c932591.tar.bz2 binaryen-2711d4fe4b4514ea146e8810959a8f170c932591.zip |
[NFC] Eagerly create Functions in binary parser (#6957)
In preparation for using IRBuilder in the binary parser, eagerly create
Functions when parsing the function section so that they are already
created once we parse the code section. IRBuilder will require the
functions to exist when parsing calls so it can figure out what type
each call should have, even when there is a call to a function whose
body has not been parsed yet.
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 46d519e9e..d49bc2974 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2980,6 +2980,9 @@ void PrintSExpression::visitDefinedGlobal(Global* curr) { void PrintSExpression::visitFunction(Function* curr) { if (curr->imported()) { visitImportedFunction(curr); + } else if (curr->body == nullptr) { + // We are in the middle of parsing the module and have not parsed this + // function's code yet. Skip it. } else { visitDefinedFunction(curr); } |