void ResolveAbstractEvent(ClassDefinition node, TypeReference baseTypeRef, IEvent baseEvent) { var ev = node.Members[baseEvent.Name] as Event; if (ev != null) { ProcessEventImplementation(ev, baseEvent); return; } if (CheckInheritsImplementation(node, baseEvent) != InheritsImplementationStyle.None) { return; } TypeMember conflicting; if (null != (conflicting = node.Members[baseEvent.Name])) { //we've got a non-resolved conflicting member Error(CompilerErrorFactory.ConflictWithInheritedMember(conflicting, (IMember)GetEntity(conflicting), baseEvent)); return; } AddStub(node, CodeBuilder.CreateAbstractEvent(baseTypeRef.LexicalInfo, baseEvent)); AbstractMemberNotImplemented(node, baseTypeRef, baseEvent); }
void ResolveClassAbstractProperty(ClassDefinition node, TypeReference baseTypeRef, IProperty entity) { foreach (TypeMember member in node.Members) { if (entity.Name != member.Name || NodeType.Property != member.NodeType || !IsCorrectExplicitMemberImplOrNoExplicitMemberAtAll(member, entity) || !TypeSystemServices.CheckOverrideSignature(entity.GetParameters(), GetPropertyEntity(member).GetParameters())) { continue; } Property p = (Property)member; ProcessPropertyAccessor(p, p.Getter, entity.GetGetMethod()); ProcessPropertyAccessor(p, p.Setter, entity.GetSetMethod()); if (null == p.Type) { p.Type = CodeBuilder.CreateTypeReference(entity.Type); } else { if (entity.Type != p.Type.Entity) { Error(CompilerErrorFactory.ConflictWithInheritedMember(p, p.FullName, entity.FullName)); } } return; } node.Members.Add(CreateAbstractProperty(baseTypeRef, entity)); AbstractMemberNotImplemented(node, baseTypeRef, entity); }
private void AssertValidPropertyImplementation(Property p, IProperty baseProperty) { if (baseProperty.Type != p.Type.Entity) { Error(CompilerErrorFactory.ConflictWithInheritedMember(p, GetEntity(p), baseProperty)); } AssertValidInterfaceImplementation(p, baseProperty); }
private void ProcessMethodImplementation(Method method, IMethod baseMethod) { IMethod methodEntity = GetEntity(method); CallableSignature baseSignature = TypeSystemServices.GetOverriddenSignature(baseMethod, methodEntity); if (IsUnknown(methodEntity.ReturnType)) { method.ReturnType = CodeBuilder.CreateTypeReference(baseSignature.ReturnType); } else if (baseSignature.ReturnType != methodEntity.ReturnType) { Error(CompilerErrorFactory.ConflictWithInheritedMember(method, methodEntity, baseMethod)); } }
void ResolveAbstractMethod(ClassDefinition node, TypeReference baseTypeRef, IMethod entity) { if (entity.IsSpecialName) { return; } foreach (TypeMember member in node.Members) { if (entity.Name == member.Name && NodeType.Method == member.NodeType && IsCorrectExplicitMemberImplOrNoExplicitMemberAtAll(member, entity)) { Method method = (Method)member; if (TypeSystemServices.CheckOverrideSignature(GetEntity(method), entity)) { if (IsUnknown(method.ReturnType)) { method.ReturnType = CodeBuilder.CreateTypeReference(entity.ReturnType); } else { if (entity.ReturnType != method.ReturnType.Entity) { Error(CompilerErrorFactory.ConflictWithInheritedMember(method, method.FullName, entity.FullName)); } } if (null != method.ExplicitInfo) { method.ExplicitInfo.Entity = entity; } if (!method.IsOverride && !method.IsVirtual) { method.Modifiers |= TypeMemberModifiers.Virtual; } _context.TraceInfo("{0}: Method {1} implements {2}", method.LexicalInfo, method, entity); return; } } } node.Members.Add(CodeBuilder.CreateAbstractMethod(baseTypeRef.LexicalInfo, entity)); AbstractMemberNotImplemented(node, baseTypeRef, entity); }
void ResolveAbstractEvent(ClassDefinition node, TypeReference baseTypeRef, IEvent baseEvent) { var ev = node.Members[baseEvent.Name] as Event; if (ev != null) { ProcessEventImplementation(ev, baseEvent); return; } if (CheckInheritsInterfaceImplementation(node, baseEvent)) { return; } foreach (var baseType in node.BaseTypes) { var baseClassDefinition = ClassDefinitionFor(baseType); if (baseClassDefinition != null) { _depth++; ResolveAbstractEvent(baseClassDefinition, baseTypeRef, baseEvent); _depth--; } } if (_depth == 0) { TypeMember conflicting; if (null != (conflicting = node.Members[baseEvent.Name])) { //we've got a non-resolved conflicting member Error(CompilerErrorFactory.ConflictWithInheritedMember(conflicting, (IMember)GetEntity(conflicting), baseEvent)); return; } AddStub(node, CodeBuilder.CreateAbstractEvent(baseTypeRef.LexicalInfo, baseEvent)); AbstractMemberNotImplemented(node, baseTypeRef, baseEvent); } }
void ResolveAbstractMethod(ClassDefinition node, TypeReference baseTypeRef, IMethod entity) { if (entity.IsSpecialName) { return; } foreach (TypeMember member in node.Members) { if (entity.Name == member.Name && NodeType.Method == member.NodeType && IsCorrectExplicitMemberImplOrNoExplicitMemberAtAll(member, entity)) { Method method = (Method)member; if (TypeSystemServices.CheckOverrideSignature(GetEntity(method), entity)) { if (IsUnknown(method.ReturnType)) { method.ReturnType = CodeBuilder.CreateTypeReference(entity.ReturnType); } else { if (entity.ReturnType != method.ReturnType.Entity) { Error(CompilerErrorFactory.ConflictWithInheritedMember(method, method.FullName, entity.FullName)); } } if (null != method.ExplicitInfo) { method.ExplicitInfo.Entity = entity; } if (!method.IsOverride && !method.IsVirtual) { method.Modifiers |= TypeMemberModifiers.Virtual; } _context.TraceInfo("{0}: Method {1} implements {2}", method.LexicalInfo, method, entity); return; } } } foreach (SimpleTypeReference parent in node.BaseTypes) { if (_classDefinitionList.Contains(parent.Name)) { depth++; ResolveAbstractMethod(_classDefinitionList[parent.Name] as ClassDefinition, baseTypeRef, entity); depth--; } } if (CheckInheritsInterfaceImplementation(node, entity)) { return; } if (depth == 0) { if (!AbstractMemberNotImplemented(node, baseTypeRef, entity)) { //BEHAVIOR < 0.7.7: no stub, mark class as abstract node.Members.Add(CodeBuilder.CreateAbstractMethod(baseTypeRef.LexicalInfo, entity)); } } }