-
Notifications
You must be signed in to change notification settings - Fork 1.1k
A more memory efficient directives container #4027
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,20 +34,16 @@ public interface DirectivesContainer<T extends DirectivesContainer> extends Node | |
| * | ||
| * @return a map of all directives by directive name | ||
| */ | ||
| default Map<String, List<Directive>> getDirectivesByName() { | ||
| return ImmutableMap.copyOf(allDirectivesByName(getDirectives())); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was terribly memory inefficient |
||
| } | ||
| Map<String, List<Directive>> getDirectivesByName(); | ||
|
|
||
| /** | ||
| * Returns all of the directives with the provided name, including repeatable and non repeatable directives. | ||
| * Returns all the directives with the provided name, including repeatable and non repeatable directives. | ||
| * | ||
| * @param directiveName the name of the directives to retrieve | ||
| * | ||
| * @return the directives or empty list if there is not one with that name | ||
| */ | ||
| default List<Directive> getDirectives(String directiveName) { | ||
| return getDirectivesByName().getOrDefault(directiveName, emptyList()); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was terribly memory inefficient |
||
| } | ||
| List<Directive> getDirectives(String directiveName); | ||
|
|
||
| /** | ||
| * This returns true if the AST node contains one or more directives by the specified name | ||
|
|
@@ -56,7 +52,5 @@ default List<Directive> getDirectives(String directiveName) { | |
| * | ||
| * @return true if the AST node contains one or more directives by the specified name | ||
| */ | ||
| default boolean hasDirective(String directiveName) { | ||
| return !getDirectives(directiveName).isEmpty(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was terribly memory inefficient |
||
| } | ||
| boolean hasDirective(String directiveName); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer have default methods - but rather a memory efficient DirectivesHolder helper