Skip to content
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

Rename members when they collide with return/parameter type names #265

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jun 27, 2024

Web IDL allows members to have the same name as their return or parameter types. Dart does not, and therefore, we have to rename them. Cleans up some existing code and makes renaming consistent by always adding an underscore if needed.

srujzs added 2 commits June 27, 2024 14:31
Web IDL allows members to have the same name as their
return or parameter types. Dart does not, and therefore,
we have to rename them. Cleans up some existing code and
makes renaming consistent by always adding an underscore
if needed.
@srujzs srujzs requested a review from kevmoo June 27, 2024 21:34
Copy link
Member

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing this is tested with the latest idl bits?

@srujzs
Copy link
Contributor Author

srujzs commented Jun 27, 2024

Yup, here's the diff from the update to this CL + the update:

--- a/lib/src/dom/saa_non_cookie_storage.dart
+++ b/lib/src/dom/saa_non_cookie_storage.dart
@@ -45,10 +45,12 @@ extension type StorageAccessHandle._(JSObject _) implements JSObject {
   external void revokeObjectURL(String url);

   /// > **Note:** See [BroadcastChannel.BroadcastChannel] to understand usage.
-  external BroadcastChannel BroadcastChannel(String name);
+  @JS('BroadcastChannel')
+  external BroadcastChannel BroadcastChannel_(String name);

   /// > **Note:** See [SharedWorker.SharedWorker] to understand usage.
-  external SharedWorker SharedWorker(
+  @JS('SharedWorker')
+  external SharedWorker SharedWorker_(
     String scriptURL, [
     JSAny options,
   ]);

@srujzs srujzs merged commit 50239e9 into dart-lang:main Jun 27, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants