forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Generator] Ensure that selectors fields do not have overlapping names.
Fixes xamarin#18645 The way the generator names private fields for selectors results on not compilable code when there are two selectoors A and B such that selector B == AHandle. That is, if selector A is "user", selector B will be "userHandle". This happens because Handle is quite a common postfix in security when working with user accounts (userHandler and others) and we need to ensure that the Handle postfix added by the generator is unique. As stated in the bug we could try to fix this by keeping track of the variables in the context in wich the generator is creating code. The problem with such approach is that it will make very hard to predict the name of the fields making the manual code harder to write. The PR contains examples of such manual code. To fix the situation we have moved from using Handle to XHandle as a postfix in the field names whihc reduces the chances of finding a similar corner case in the future. A test has been added to show the case in which we found the bug. Fixes xamarin#18645
- Loading branch information
1 parent
26b46ed
commit 70f6d30
Showing
9 changed files
with
62 additions
and
15 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
namespace GHIssue18645{ | ||
|
||
[Protocol] | ||
[BaseType (typeof(NSObject))] | ||
interface ASCredentialIdentity { | ||
|
||
[Abstract] | ||
[Export ("user")] | ||
string User { get; } | ||
|
||
[Abstract] | ||
[NullAllowed, Export ("recordIdentifier")] | ||
string RecordIdentifier { get; } | ||
|
||
[Abstract] | ||
[Export ("rank")] | ||
nint Rank { get; set; } | ||
} | ||
|
||
[BaseType (typeof (NSObject))] | ||
interface ASPasskeyCredentialIdentity : ASCredentialIdentity { | ||
[Export ("relyingPartyIdentifier")] | ||
string RelyingPartyIdentifier { get; } | ||
|
||
[Export ("userName")] | ||
string UserName { get; } | ||
|
||
[Export ("credentialID", ArgumentSemantic.Copy)] | ||
NSData CredentialID { get; } | ||
|
||
[Export ("userHandle", ArgumentSemantic.Copy)] | ||
NSData UserHandle { get; } | ||
|
||
[NullAllowed, Export ("recordIdentifier")] | ||
new string RecordIdentifier { get; } | ||
|
||
[Export ("rank")] | ||
new nint Rank { get; set; } | ||
} | ||
|
||
} |