private void putMethods(TypeInfo declaringType, Map <String, MemberInfo> members) { foreach (var method in declaringType.Methods.where (p => !p.IsSynthetic && !p.Name.startsWith("<"))) { var isPropertyAccessor = false; foreach (var annotation in BytecodeHelper.getAnnotations(annotatedTypeSystem, method)) { if (BytecodeHelper.isPropertyGet(annotation)) { isPropertyAccessor = true; break; } if (BytecodeHelper.isPropertySet(annotation)) { isPropertyAccessor = true; break; } } if (!isPropertyAccessor) { var member = MemberInfo.getInfo(method); members[method.Name + method.Signature] = member; } } foreach (var method in getExtensionMethods().where ( p => BytecodeHelper.hasImplicitConversion(declaringType, p.Parameters.first().Type))) { var member = MemberInfo.getInfo(method); members[method.Name + method.Signature] = member; } }
private void putProperties(TypeInfo declaringType, Map <String, MemberInfo> members) { var getters = new HashMap <String, MethodInfo>(); var setters = new HashMap <String, MethodInfo>(); foreach (var method in declaringType.Methods.where (p => !p.IsSynthetic && !p.Name.startsWith("<"))) { foreach (var annotation in BytecodeHelper.getAnnotations(annotatedTypeSystem, method)) { if (BytecodeHelper.isPropertyGet(annotation)) { var name = BytecodeHelper.getPropertyGetName(method, annotation); getters[name] = method; break; } if (BytecodeHelper.isPropertySet(annotation)) { var name = BytecodeHelper.getPropertySetName(method, annotation); setters[name] = method; break; } } } foreach (var e in getters.entrySet()) { var setter = setters.remove(e.Key); var member = MemberInfo.getInfo(e.Value, setter, e.Key); members[e.Key] = member; } foreach (var e in setters.entrySet()) { var member = MemberInfo.getInfo(null, e.Value, e.Key); members[e.Key] = member; } }
public override Iterable <MemberInfo> getOverridenMembers(Library typeSystem) { if (overridenMembers == null) { if (!this.IsStatic) { foreach (var t in this.DeclaringType.getBaseTypes()) { MethodInfo get = null; MethodInfo set = null; foreach (var m in t.Methods) { var pinfo = m.getUserData(typeof(PropertyMemberInfo)); if (pinfo != null) { if (!pinfo.Name.equals(name) || pinfo.IsStatic) { continue; } if (!pinfo.IsPrivate) { if (overridenMembers == null) { overridenMembers = new HashSet <MemberInfo>(); } overridenMembers.add(pinfo); } break; } foreach (var annotation in BytecodeHelper.getAnnotations(typeSystem, m)) { if (BytecodeHelper.isPropertyGet(annotation) && name.equals(BytecodeHelper.getPropertyGetName(m, annotation))) { get = m; break; } if (BytecodeHelper.isPropertySet(annotation) && name.equals(BytecodeHelper.getPropertySetName(m, annotation))) { set = m; break; } } } if (get != null || set != null) { if (overridenMembers == null) { overridenMembers = new HashSet <MemberInfo>(); } overridenMembers.add(MemberInfo.getInfo(get, set, name)); } } } if (overridenMembers == null) { overridenMembers = Collections.emptySet <MemberInfo>(); } } return(overridenMembers); }