Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Property functions: delay static function receiver type resolution un…
…til the method name is known Types for the receiver of static property function calls resolved from the type cache in AvailableStaticMethods only when they were types with all of their methods whitelisted (thus appearing only with their type name in the cache, not typeName::methodName). This caused partially whitelisted types as File and Directory to always miss the cache and resolve with Type.GetType() On .net core this is a problem because namespaces are being moved out from mscorlib to their own dlls, which causes Type.GetType to fail because it assumes that namespace qualified types are from either the current assembly, or from mscorlib. For example, Type.GetType("System.IO.File") resolves on net46 but not on .net core. To fix this, I delayed the type resolution for static invocations only after the method name is known. This way, the code can construct the method qualified name and properly search the cache for the type. Other edits: - refactored Function.ExtractPropertyFunction to use disjunct construction branches for each type of property function, rather than a soup of intertwined logic. Should make future refactoring easier (i.e., creating some builder subclasses for each property function type) - added a FunctionBuilder type that aggregates all the function parts needed for a property function and changed the code to use it. This way, control flow gets decoupled from a partially constructed function which allows me to easily change the order in which functions parts get constructed. Downside is the function state duplication. - added convenience methods in the AvailableStaticMethods class
- Loading branch information