Skip to content

Commit

Permalink
Clean up TextDocument line map after codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadeeshan96 committed Oct 13, 2023
1 parent ec28a7c commit 0bdc348
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,8 @@ void shrink() {
this.compilationUnit.topLevelNodes.clear();
}
this.content = null;
if (this.textDocument != null) {
this.textDocument.cleanUp();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class StringTextDocument extends TextDocument {
this.text = text;
}

@Override
public void cleanUp() {
this.textLineMap = null;
}

@Override
public TextDocument apply(TextDocumentChange textDocumentChange) {
int startOffset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
public abstract class TextDocument {
private LineMap lineMap;

public abstract void cleanUp();

public abstract TextDocument apply(TextDocumentChange textDocumentChange);

protected abstract LineMap populateTextLineMap();
Expand Down

0 comments on commit 0bdc348

Please sign in to comment.