Conversation
src/WpfEditor/WpfEditor.csproj
Outdated
| <Prefer32Bit>true</Prefer32Bit> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Reference Include="Antlr4.Runtime.Standard, Version=4.7.1.0, Culture=neutral, PublicKeyToken=e78b2c5abd1fcb3f, processorArchitecture=MSIL"> |
There was a problem hiding this comment.
WpfEditor точно должен зависеть от ANTLR?
| <Generator>ResXFileCodeGenerator</Generator> | ||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
| </EmbeddedResource> | ||
| <None Include="packages.config" /> |
| @@ -0,0 +1,4 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
There was a problem hiding this comment.
Этот файл не нужен, управление зависимостями делается Paket-ом
src/plugins/OclPlugin/FunctionDef.cs
Outdated
| public List<string> param; | ||
| public OclParser.ExpressionContext context; | ||
| } | ||
| } |
There was a problem hiding this comment.
Тут с отступами какая-то беда
src/plugins/OclPlugin/FunctionDef.cs
Outdated
| { | ||
| public string name; | ||
| public List<string> param; | ||
| public OclParser.ExpressionContext context; |
src/plugins/OclPlugin/OclPrinter.cs
Outdated
| } | ||
| else if (context.pathName().GetText() == "forAll") | ||
| { | ||
| Dictionary<string, object> st = new Dictionary<string, object>(); |
There was a problem hiding this comment.
Тут тоже надо var. И вообще, посмотрите по коду, кажется, ещё много где var был бы уместен.
src/plugins/OclPlugin/OclPrinter.cs
Outdated
| else if (this.Res is LinkedList<object>) | ||
| { | ||
| ar = new LinkedList<object>(); | ||
| } |
There was a problem hiding this comment.
Есть же switch с pattern matching-ом
src/plugins/OclPlugin/OclPrinter.cs
Outdated
| } | ||
| else if (context.pathName().GetText() == "select") | ||
| { | ||
| ICollection<object> ar = null; |
There was a problem hiding this comment.
На всякий случай ещё раз настоятельно рекомендую убрать все сокращения :) Это ж не ассемблер.
src/plugins/OclPlugin/OclPrinter.cs
Outdated
| } | ||
|
|
||
| return this.VisitPathName(context.pathName()); | ||
| } |
There was a problem hiding this comment.
Стоит разбить на методы поменьше
src/plugins/OclPlugin/OclPrinter.cs
Outdated
| using EditorPluginInterfaces; | ||
| using Repo; | ||
|
|
||
| internal class OclPrinter : OclBaseVisitor<bool> |
There was a problem hiding this comment.
А почему он Printer? Мне кажется, он больше Interpreter, чем Printer
OclPlugin.Tests/UnitTest1.cs
Outdated
| @@ -0,0 +1,41 @@ | |||
| using System.Collections.Generic; | |||
There was a problem hiding this comment.
UnitTest1.cs как имя файла, мягко говоря, не очень
OclPlugin.Tests/UnitTest1.cs
Outdated
| } | ||
|
|
||
| [Test] | ||
| public void Test1() |
OclPlugin.Tests/UnitTest1.cs
Outdated
| public void Test1() | ||
| { | ||
| var model = new WpfControlsLib.Model.Model(); | ||
| var repo = model.Repo; |
There was a problem hiding this comment.
А можно же просто репозиторий создать, через RepoFactory. Зависеть от всего GUI только для того, чтобы получить репозиторий, архитектурно неправильно
| public override Result Divide(Result res) | ||
| { | ||
| throw new NotImplementedException(); | ||
| } |
There was a problem hiding this comment.
Тут лучше везде expression-bodied-синтаксис использовать,
public override Result Divide(Result res) => throw new NotImplementedException();А конкретно эти методы я бы вообще в базовом классе реализовал как бросающие NotImplementedException, чтобы в потомках не писать одно и то же дважды
| public abstract Result Multiply(Result res); | ||
|
|
||
| public abstract Result Divide(Result res); | ||
| } |
There was a problem hiding this comment.
Абстрактный класс, к уоторого нет полей и все методы абстрактные --- это интерфейс
| { | ||
| private readonly ArrayList<Dictionary<string, Result>> vars; | ||
| private readonly OclCalculator calculator; | ||
| private readonly Dictionary<string, FunctionDefinition> funcs; |
| return filteredElements; | ||
| } | ||
|
|
||
| Dictionary<string, Result> stack = new Dictionary<string, Result>(); |
|
|
||
| this.vars.RemoveAt(this.vars.Count - 1); | ||
| return filteredElements; | ||
| } |
There was a problem hiding this comment.
Этот гигантский if можно как-то более поООПшному сделать, мне кажется. context.pathName().GetText() используется как тэг типа, а тела if-ов --- как виртуальные методы, а всё это вместе --- симуляция lookup-а в VMT вручную.
No description provided.