-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the CodeGeneratorExtensions.pm generated code for the most c…
…ommon optional argument case. https://webkit.org/b/261163 rdar://problem/114986995 Reviewed by Brian Weinstein. Refine the argument handling for the Web Extension code generator. * Streamlined argument handling for the common 2 and 3 argument cases, specifically when the last argument is optional. * Replaced the previous loop-based method for these cases with more direct conditional checks. * Complex handling remains in place for scenarios with multiple optional arguments beyond 3 total arguments. * Cuts down the functions using the complex method from roughly 50 to just 7. * Helps both improved readability and potential generated code performance. * Source/WebKit/WebProcess/Extensions/Bindings/Cocoa/JSWebExtensionWrapperCocoa.mm: (WebKit::toNSString): Only try to convert strings. (WebKit::toNSDictionary): Don't try to convert functions or promises. * Source/WebKit/WebProcess/Extensions/Bindings/Scripts/CodeGeneratorExtensions.pm: (_generateImplementationFile): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIExtension.mm: (TestWebKitAPI::TEST): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/267695@main
- Loading branch information
Showing
4 changed files
with
97 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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 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 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 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