Last active
October 11, 2015 10:47
-
-
Save mzaks/567cef2bb224ba9b6eaa to your computer and use it in GitHub Desktop.
Extract component type name from member reference expression and add it to the type names set
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
| static void AddType (MemberReferenceExpression identifier, HashSet<string> typeNames, HashSet<string> componentTypes) | |
| { | |
| var memberName = UppercaseFirst(identifier.MemberName); | |
| if(!componentTypes.Contains(memberName)){ | |
| foreach(string prefix in new string[]{"Has", "Add", "Is", "Replace", "Remove", "Set"}){ | |
| if(memberName.StartsWith(prefix)){ | |
| memberName = memberName.TrimStart(prefix.ToCharArray()); | |
| break; | |
| } | |
| } | |
| } | |
| if(componentTypes.Contains(memberName)){ | |
| typeNames.Add (memberName); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment