Codegen Attributes (#1299)
* Initial tests for static call wrap
* Finally sort of got somewhere... bit of a nightmare to debug this right now. Allow multiple CodeGenAttribute. Remove from ClientRpc and add some tests locally instead
* Support CodeGenType.Instance with CodeGenType.WrapCall
* Added first version of WrapSet/WrapGet
* Unit test stubs
* Don't pass value for get accessor..
* Cast to original return type in get accessor when wrapping
* Tests build
* Let CodeGenType.WrapCall proxies return their own values. They can simple do "return resume();" if they wanna keep intended behavior, so we can also wrap methods that don't just return void
* Fixed a bug with static set/get wrap codegen not passing correct method name. Now support also adding [CodeGen] attributes directly to a method or property bypassing an attribute alias, these don't require setting the Instance/Static flags.
* Use nameof where possible
* Fixed tests for WrapSet/WrapGet
* Improve documentation
* Improve docs for CodeGenAttribute
* More documentation
* Fixed logic in WrapSet
* Added method validation. Compiler will let you know what methods you're missing when using CodeGen and what types, return types etc they need
* Add some extra tests
* Only allow CodeGen on custom attributes. Tidy up. CallbackName for CodeGenType.Static is the actual fully qualified name of static method to call
* Auto generate backing fields for properties. Pass current value in WrapGet callbacks. Set backing field before calling WrapSet callbacks. Update method validation error prints appropriately
* Fixed ValidatePropertyCallback
* Can now propertly wrap setters/getters. Setter callback passes Action<T> you can call to run default behavior
* Fix error if value statement empty
* Update tests
* Fix TestWrapSet
* Run WrapSet and WrapGet if both are specified. When passing to static callback always pass propertyName or methodName as fully qualified name.
* Support type argument for return type and Func param
* Nicer error when can't find type to invoke on for passed callback name
* CodeGeneratorFlags/CodeGeneratorAttribute renaming
* Update tests
* WrapPropertySet, WrapPropertyGet, WrapMethod
* Fix tests + fix issues with props that only have set; or get;
* No need to wrap getValue() body in {} as already have them
* Use SemanticModel.LookupSymbols to find and validate methods taking inheritance into account
* Remove leftover test code