Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for DynamicObject members
Since DynamicObject objects require a compiler, referenced Microsoft.CSharp to do the compiling. For the time being, using Dynamitey as a dependency since it provides the Dynamic.InvokeGet(object, memberName) function, which otherwise would require a large amount of additional work, which the Dynamitey.Dynamic static class already provides. Perhaps the parts of Dynamitey that were used could be imported into the Mustache# project in a later change. This has been tested using DynamicObject objects that have members, but I'm not sure yet how to interface this with any type of indexed DynamicObjects, for instance, a dynamic IList<T>. It isn't completely clear how to find the domain of the function without stepping through through all the valid indexes in the domain; for instance, we could presume it starts at [0] where [0] != null and ends at [0...i-1] where [i] == null. I still need to interrogate the library further to find out where Scope/Generator figures out that it has a list on its hand instead of an object; or, whether this only occurs with the employ of helpers such as {{#each}}{{/each}}. In any event, that might be where to interrogate the Dynamic.InvokeGetIndex(instance, { index }). For now, I've tested this to work with a specialized System.Dynamic.DynamicObject class, which does override the TryGetMember() method, and Mustache# does in fact invoke this method, thanks to Dynamitey.
- Loading branch information