branchsbox/codegen-attributescancel
21 Commits over 0 Days - ∞cph!
Remove leftover test code
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
WrapPropertySet, WrapPropertyGet, WrapMethod
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
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
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
Only allow CodeGen on custom attributes. Tidy up. CallbackName for CodeGenType.Static is the actual fully qualified name of static method to call
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
Improve docs for CodeGenAttribute
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
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
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
Support CodeGenType.Instance with CodeGenType.WrapCall
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
Initial tests for static call wrap