Skip to content

Кр 3 - #28

Open
Palezehvat wants to merge 3 commits into
masterfrom
Kr3
Open

Palezehvat wants to merge 3 commits into
masterfrom
Kr3

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

No description provided.

@yurii-litvinov yurii-litvinov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • CI не работает, там в тестах что-то с переводами строк не сложилось.
  • Параметры-типы в методах, кстати, не поддерживаются, но это ладно :)

Comment thread Kr3/Kr3/Reflector.cs

namespace Kr3;

public class Reflector

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо комментарии

Comment thread Kr3/Kr3/Reflector.cs
using System.Linq.Expressions;
using System.Reflection;

namespace Kr3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace лучше писать первой строкой в файле, хотя дело вкуса

Comment thread Kr3/Kr3/Reflector.cs
Comment on lines +33 to +36
private static string GetStaticOrNotFromClass(Type someClass)
{
return someClass.IsAbstract && someClass.IsSealed ? "static " : "";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут и ниже лучше через => писать

Comment thread Kr3/Kr3/Reflector.cs
return "internal ";
}
return "";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так-то MethodInfo и ConstructorInfo — потомки MethodBase (потому что они суть методы), и IsPrivate/IsPublic/и т.д. — это свойства MethodBase. Так что один из этих двух методов не нужен.

Comment thread Kr3/Kr3/Reflector.cs
return "";
}

private void WriteParameters(StreamWriter writer, ParameterInfo[] parameters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было бы сделать решение несколько более ООПшным, если бы разделить читалку структуры класса и писалку результатов в разные классы.

Comment thread Kr3/Kr3/Reflector.cs
Comment on lines +209 to +210
}
private static void WriteDifferentFields(StreamWriter writer,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
private static void WriteDifferentFields(StreamWriter writer,
}
private static void WriteDifferentFields(StreamWriter writer,

Comment thread Kr3/Kr3/Reflector.cs
return methodB != null;
}

private static void WriteDifferentMethods(StreamWriter writer,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну и механизм диффов, видимо, можно было бы в отдельный класс вынести. Тут у Вас принцип единственности ответственности настолько нарушен, насколько это возможно.

@@ -0,0 +1,6 @@
class TestClassSum

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не выкладывайте ничего в bin/Debug. А то я вот перешёл на .NET 8 (и Вам советую, .NET 7 уже пару месяцев как ненужное старьё), и у меня эти файлы не находятся.

Comment thread Kr3/Kr3/Reflector.cs
else if (someField.IsAssembly)
{
return "internal ";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кстати, есть ещё protected internal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants