| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -3943,14 +3943,15 @@ def CheckForNonStandardConstructs(filename, clean_lines, linenum, nesting_state, | |
| else: | ||
| constructor_args = explicit_constructor_match.group(2).split(",") | ||
|
|
||
| # collapse arguments so that commas in template parameter lists and function | ||
| # argument parameter lists don't split arguments in two | ||
| # Collapse commas inside template and function parameter lists. | ||
| i = 0 | ||
| while i < len(constructor_args): | ||
| constructor_arg = constructor_args[i] | ||
| while constructor_arg.count("<") > constructor_arg.count(">") or constructor_arg.count( | ||
| "(" | ||
| ) > constructor_arg.count(")"): | ||
| # Ignore `<`-prefixed operators when balancing template brackets. | ||
| while i + 1 < len(constructor_args) and ( | ||
| re.sub(r"<<=?|<=", "", constructor_arg).count("<") > constructor_arg.count(">") | ||
| or constructor_arg.count("(") > constructor_arg.count(")") | ||
|
Comment thread
Comment on lines
+3952
to
+3953
Copy link
Copy Markdown
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis seems very inefficient. We were already using .count to do four optimized single-character passes, and now we add a regex pass on top of that. Not to mention we're sort of simulating regex with the consuming (del) of tokens below, and adding onto our misery by going over parts of constructor_arg we've already searched again with each loop. Surely we can simplify at least this part to O(n).
Sorry, something went wrong.
All reactions
|
||
| ): | ||
| constructor_arg += "," + constructor_args[i + 1] | ||
| del constructor_args[i + 1] | ||
| constructor_args[i] = constructor_arg | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIs there a reason for this change?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.