/// <summary> /// Check is given <paramref name="declarerName"/> and its <paramref name="typeParams"/> are without duplicity. /// </summary> /// <param name="typeParams">Generic type parameters.</param> /// <param name="declarerName">Type name.</param> private void CheckTypeParameterNames(List <FormalTypeParam> typeParams, string /*!*/ declarerName) { if (typeParams == null) { return; } for (int i = 0; i < typeParams.Count; i++) { if (typeParams[i].Name.Equals(declarerName)) { ErrorSink.Add(Errors.GenericParameterCollidesWithDeclarer, SourceUnit, typeParams[i].Position, declarerName); } else if (CurrentScopeAliases.ContainsKey(typeParams[i].Name.Value)) { ErrorSink.Add(Errors.GenericAlreadyInUse, SourceUnit, typeParams[i].Position, typeParams[i].Name.Value); } else { for (int j = 0; j < i; j++) { if (typeParams[j].Name.Equals(typeParams[i].Name)) { errors.Add(Errors.DuplicateGenericParameter, SourceUnit, typeParams[i].Position); } } } } }
private void CheckTypeNameInUse(Name typeName, Position position) { if (CurrentScopeAliases.ContainsKey(typeName.Value) || reservedTypeNames.Contains(typeName.Value)) { errors.Add(FatalErrors.ClassAlreadyInUse, SourceUnit, position, CurrentNamespaceName + typeName.Value); } }