Skip to content

Commit

Permalink
Убрано хранение всегда пустой коллекции детей переменных, оптимизация…
Browse files Browse the repository at this point in the history
… используемой памяти
  • Loading branch information
nixel2007 committed Jan 12, 2024
1 parent dd09dcc commit 1657517
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@NonFinal
@Builder(builderClassName = "Builder")
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString(exclude = {"children", "parent"})
@ToString(exclude = {"parent"})
public abstract class AbstractVariableSymbol implements VariableSymbol {

/**
Expand Down Expand Up @@ -74,12 +74,6 @@ public abstract class AbstractVariableSymbol implements VariableSymbol {
@NonFinal
Optional<SourceDefinedSymbol> parent;

/**
* Список "детей" символа - символов, которые располагаются внутри данного символа.
*/
@Getter
List<SourceDefinedSymbol> children;

/**
* Тип переменной.
*/
Expand All @@ -95,6 +89,11 @@ public abstract class AbstractVariableSymbol implements VariableSymbol {
*/
Optional<VariableDescription> description;

@Override
public List<SourceDefinedSymbol> getChildren() {
return Collections.emptyList();
}

@Override
public SymbolKind getSymbolKind() {
return SymbolKind.Variable;
Expand Down Expand Up @@ -129,10 +128,6 @@ public static class Builder {
@Accessors(fluent = true, chain = true)
Optional<SourceDefinedSymbol> parent = Optional.empty();

@Setter
@Accessors(fluent = true, chain = true)
List<SourceDefinedSymbol> children = Collections.emptyList();

private int startLine;
private int startCharacter;
private int endLine;
Expand Down Expand Up @@ -179,7 +174,6 @@ public VariableSymbol build() {
scope,
owner,
parent,
children,
(byte) kind.ordinal(),
export,
description,
Expand All @@ -197,7 +191,6 @@ public VariableSymbol build() {
scope,
owner,
parent,
children,
(byte) kind.ordinal(),
export,
description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import lombok.experimental.NonFinal;
import org.eclipse.lsp4j.Range;

import java.util.List;
import java.util.Optional;

/**
Expand Down Expand Up @@ -65,7 +64,6 @@ public IntBasedVariableSymbol(
SourceDefinedSymbol scope,
DocumentContext owner,
Optional<SourceDefinedSymbol> parent,
List<SourceDefinedSymbol> children,
byte kind,
boolean export,
Optional<VariableDescription> description,
Expand All @@ -77,7 +75,7 @@ public IntBasedVariableSymbol(
int variableNameStartCharacter,
int variableNameEndCharacter
) {
super(name, scope, owner, parent, children, kind, export, description);
super(name, scope, owner, parent, kind, export, description);

this.startLine = startLine;
this.startCharacter = startCharacter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import lombok.experimental.NonFinal;
import org.eclipse.lsp4j.Range;

import java.util.List;
import java.util.Optional;

/**
Expand Down Expand Up @@ -65,7 +64,6 @@ public ShortBasedVariableSymbol(
SourceDefinedSymbol scope,
DocumentContext owner,
Optional<SourceDefinedSymbol> parent,
List<SourceDefinedSymbol> children,
byte kind,
boolean export,
Optional<VariableDescription> description,
Expand All @@ -77,7 +75,7 @@ public ShortBasedVariableSymbol(
short variableNameStartCharacter,
short variableNameEndCharacter
) {
super(name, scope, owner, parent, children, kind, export, description);
super(name, scope, owner, parent, kind, export, description);

this.startLine = startLine;
this.startCharacter = startCharacter;
Expand Down

0 comments on commit 1657517

Please sign in to comment.