Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Использование Set для обхода ошибки дублирования узлов методов в дереве разбора #1889

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
Expand All @@ -60,7 +61,7 @@ public final class MethodSymbolComputer
BSLParser.ANNOTATION_ATCLIENTATSERVER_SYMBOL);

private final DocumentContext documentContext;
private final List<MethodSymbol> methods = new ArrayList<>();
private final Set<MethodSymbol> methods = new HashSet<>();
Copy link
Contributor

@artbear artbear Oct 22, 2021

Choose a reason for hiding this comment

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

а почему Collection не использовал?

@nixel2007

Copy link
Member Author

Choose a reason for hiding this comment

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

для указания семантики уникальности


public MethodSymbolComputer(DocumentContext documentContext) {
this.documentContext = documentContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class RegionSymbolComputer
extends BSLParserBaseVisitor<ParseTree>
Expand All @@ -42,7 +44,7 @@ public final class RegionSymbolComputer
private final DocumentContext documentContext;
private final Deque<Pair<RegionSymbol.RegionSymbolBuilder, BSLParser.RegionStartContext>> regionStack =
new ArrayDeque<>();
private final List<RegionSymbol> regions = new ArrayList<>();
private final Set<RegionSymbol> regions = new HashSet<>();

public RegionSymbolComputer(DocumentContext documentContext) {
this.documentContext = documentContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
import org.antlr.v4.runtime.tree.ParseTree;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

public class VariableSymbolComputer extends BSLParserBaseVisitor<ParseTree> implements Computer<List<VariableSymbol>> {

private final DocumentContext documentContext;
private final List<VariableSymbol> variables = new ArrayList<>();
private final Set<VariableSymbol> variables = new HashSet<>();

public VariableSymbolComputer(DocumentContext documentContext) {
this.documentContext = documentContext;
Expand Down