Esempio n. 1
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, Func<KeyValuePair<string, Accessor>, bool> filter)
 {
     foreach (KeyValuePair<string, Accessor> accessor in accessors) {
         if (!filter(accessor)) continue;
         if (parameterCount == 1) return new SetterMember(accessor.Value);
         if (parameterCount == 0) return new GetterMember(accessor.Value);
     }
     throw new ArgumentException(string.Format("Missing member '{0}'", memberName.SourceName));
 }
Esempio n. 2
0
 public bool Equals(IdentifierName other) {
     return other != null && Matches(other.MatchName);
 }
Esempio n. 3
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, IList<Type> parameterTypes)
 {
     return columnAccessors.Find(memberName, parameterCount, accessor => {
         string accessorName = accessor.Key.EndsWith("=")
                                   ? accessor.Key.Substring(0, accessor.Key.Length - 1)
                                   : accessor.Key;
         if (!memberName.Matches(accessorName)) return false;
         if (currentHeader != null && currentHeader.Text.EndsWith("=") && !accessor.Key.EndsWith("=")) return false;
         if (currentHeader != null && !currentHeader.Text.EndsWith("=") && accessor.Key.EndsWith("=")) return false;
         return true;
     });
 }
Esempio n. 4
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, Type[] parameterTypes)
 {
     return new QueryableMember(memberName.ToString());
 }
Esempio n. 5
0
 public bool Equals(IdentifierName other)
 {
     return(other != null && Matches(other.MatchName));
 }
Esempio n. 6
0
 public static RuntimeMember GetInstance(TypedValue instance, IdentifierName memberName, int parameterCount)
 {
     RuntimeMember runtimeMember = FindInstance(instance.Value, memberName, parameterCount);
     if (runtimeMember == null) throw new MemberMissingException(instance.Type, memberName.SourceName, parameterCount);
     return runtimeMember;
 }
Esempio n. 7
0
 public RuntimeMember FindStatic(IdentifierName memberName, Type[] parameterTypes)
 {
     return new MemberQuery(memberName, parameterTypes.Length, BindingFlags.Static)
         .WithParameterTypes(parameterTypes)
         .Find(Type);
 }
Esempio n. 8
0
 public static RuntimeMember FindInstance(object instance, IdentifierName memberName, IList<string> parameterNames)
 {
     return new MemberQuery(memberName, parameterNames.Count, BindingFlags.Instance | BindingFlags.Static)
         .WithParameterNames(parameterNames)
         .Find(instance);
 }
Esempio n. 9
0
 public static RuntimeMember FindInstance(object instance, IdentifierName memberName, Type[] parameterTypes)
 {
     return new MemberQuery(memberName, parameterTypes.Length, BindingFlags.Instance | BindingFlags.Static)
         .WithParameterTypes(parameterTypes)
         .Find(instance);
 }
Esempio n. 10
0
 public static RuntimeMember FindInstance(object instance, IdentifierName memberName, int parameterCount)
 {
     return new MemberQuery(memberName, parameterCount, BindingFlags.Instance | BindingFlags.Static).Find(instance);
 }
Esempio n. 11
0
 public MemberQuery(IdentifierName memberName, int parameterCount, BindingFlags flags)
 {
     this.memberName = memberName;
     this.parameterCount = parameterCount;
     this.flags = flags;
 }
Esempio n. 12
0
 public RuntimeMember Find(IdentifierName memberName, int parameterCount, Type[] parameterTypes)
 {
     return columnAccessors.Find(memberName, parameterCount, accessor => memberName.Matches(accessor.Key));
 }
Esempio n. 13
0
 public bool MatchesGetSetName(string name)
 {
     var identifier = new IdentifierName(memberName.Name);
     if (identifier.Matches(name)) return true;
     if (!identifier.MatchName.StartsWith("set") && !identifier.MatchName.StartsWith("get")) return false;
     return new IdentifierName(identifier.MatchName.Substring(3)).Matches(name);
 }
Esempio n. 14
0
 public MemberQuery(string memberName, int parameterCount, BindingFlags flags, Type[] parameterTypes)
 {
     this.memberName = new IdentifierName(memberName);
     this.parameterCount = parameterCount;
     this.flags = flags;
     this.parameterTypes = parameterTypes;
 }