-
Notifications
You must be signed in to change notification settings - Fork 860
feat: add BinaryenExpressionAllocateAndWriteText #8717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
6457bc6
b3f7afb
fdbba7f
8f69c85
0843a21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3308,12 +3308,10 @@ Module['emitText'] = function(expr) { | |
| if (typeof expr === 'object') { | ||
| return expr.emitText(); | ||
| } | ||
| const old = out; | ||
| let ret = ''; | ||
| out = x => { ret += x + '\n' }; | ||
| Module['_BinaryenExpressionPrint'](expr); | ||
| out = old; | ||
| return ret; | ||
| const textPtr = BinaryenObj["_BinaryenExpressionAllocateAndWriteText"](expr); | ||
| const text = UTF8ToString(textPtr); | ||
| if (textPtr) _free(textPtr); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use Also, we typically use braces around
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, i again copied from the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also… digging into this project helped me learn a lot about Emscripten and where all this stuff like |
||
| return text; | ||
| }; | ||
|
|
||
| // Calls a function, wrapping it in error handling code so that if it hits a | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy_nis a little strange for copying bytes, can we usestrncpyormemcpyinstead to convey the intent better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly not sure, i just copied the exact code from
BinaryenModuleAllocateAndWriteText.I'll defer to the C developers for what's best. I'm happy as long as it's consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @stevenfontanella , but yeah, let's keep it consistent here. We can simplify all these
copy_nuses separately.