private bool FindIndexer(Type targetType) { // Get the default members MemberInfo[] members = targetType.GetDefaultMembers(); List<MethodInfo> methods = new List<MethodInfo>(); // Use the first one that's valid for our indexer type foreach (MemberInfo mi in members) { PropertyInfo pi = mi as PropertyInfo; if ((pi != null)) { methods.Add(pi.GetGetMethod(true)); } } FunctionCallElement func = new FunctionCallElement("Indexer", methods.ToArray(), MyIndexerElements); func.Resolve(MyServices); MyIndexerElement = func; return true; }
public override PerCederberg.Grammatica.Runtime.Node ExitFunctionCallExpression(PerCederberg.Grammatica.Runtime.Production node) { var childValues = this.GetChildValues(node); string name = (string)childValues[0]; childValues.RemoveAt(0); var args = new ArgumentList(childValues); var funcCall = new FunctionCallElement(name, args); node.AddValue(funcCall); return node; }