Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 879
Fix #6047, #5271: Support one-line-one-function file format for asyncify lists#6051
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -31,10 +31,14 @@ namespace wasm::String { | ||
| // Creates a vector of the split parts of a string, by a delimiter. | ||
| class Split : public std::vector<std::string> { | ||
| public: | ||
| Split() = default; | ||
| private: | ||
| // If we split on newlines then we do not need to handle bracketing at all. | ||
| // Otherwise, splitting on say "," does require us to understanding the | ||
| // scoping of brackets, e.g., "foo(x, y),bar" should be split as "foo(x, y)", | ||
| // "bar". | ||
| bool needToHandleBracketingOperations = true; | ||
| Split(const std::string& input, const std::string& delim) { | ||
| void split(const std::string& input, const std::string& delim) { | ||
| size_t lastEnd = 0; | ||
| while (lastEnd < input.size()) { | ||
| auto nextDelim = input.find(delim, lastEnd); | ||
| @@ -44,6 +48,31 @@ class Split : public std::vector<std::string> { | ||
| (*this).push_back(input.substr(lastEnd, nextDelim - lastEnd)); | ||
| lastEnd = nextDelim + delim.size(); | ||
| } | ||
| needToHandleBracketingOperations = delim != "\n"; | ||
| } | ||
| friend String::Split handleBracketingOperators(String::Split split); | ||
caiiiycuk marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| public: | ||
| // This can be used when we want to split on newlines if there are any, and if | ||
| // there are not, then using the given delimiter. | ||
| struct NewLineOr { | ||
caiiiycuk marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| const std::string delim; | ||
| explicit NewLineOr(const std::string& delim) : delim(delim) {} | ||
| }; | ||
| Split() = default; | ||
| Split(const std::string& input, const NewLineOr& newLineOrDelim) { | ||
| auto first = input.find("\n", 0); | ||
| if (first != std::string::npos && first != input.length() - 1) { | ||
| split(input, "\n"); | ||
| } else { | ||
| split(input, newLineOrDelim.delim); | ||
| } | ||
| } | ||
| Split(const std::string& input, const std::string& delim) { | ||
| split(input, delim); | ||
| } | ||
| }; | ||
| @@ -53,6 +82,10 @@ class Split : public std::vector<std::string> { | ||
| // must be kept together because of the "(". Likewise, "{", "<", "[" are | ||
| // handled. | ||
| inline String::Split handleBracketingOperators(String::Split split) { | ||
| if (!split.needToHandleBracketingOperations) { | ||
| return split; | ||
| } | ||
| String::Split ret; | ||
| std::string last; | ||
| int nesting = 0; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| foo | ||
| bar |
1 change: 1 addition & 0 deletions
1 test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1 test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.