Skip to content

Commit

Permalink
Reduce superfluous calls to .subset2(self, '...')
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jan 10, 2025
1 parent 19e487c commit ed62f64
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions R/class_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ database_class <- R6::R6Class(
out <- map(
rows,
~database_repair_list_columns(
.subset2(self, "get_row")(.x),
get_row(.x),
list_columns,
list_column_mode_list
)
Expand All @@ -143,10 +143,10 @@ database_class <- R6::R6Class(
}
},
exists_row = function(name) {
lookup_exists(.subset2(self, "lookup"), name)
lookup_exists(lookup, name)
},
list_rows = function() {
lookup_list(.subset2(self, "lookup"))
lookup_list(lookup)
},
condense_data = function(data) {
repeats <- duplicated(data$name, fromLast = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions R/class_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ graph_class <- R6::R6Class(
unname(map_int(list[names], length))
},
produce_upstream = function(name) {
as.character(.subset2(.subset2(self, "upstream"), name))
as.character(.subset2(upstream, name))
},
produce_downstream = function(name) {
as.character(.subset2(.subset2(self, "downstream"), name))
as.character(.subset2(downstream, name))
},
replace_upstream = function(name, from, to) {
upstream <- self$upstream
Expand Down
10 changes: 5 additions & 5 deletions R/class_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ meta_class <- R6::R6Class(
self$lookup <- lookup
},
get_depend = function(name) {
.subset2(.subset2(self, "depends"), name)
.subset2(depends, name)
},
get_row = function(name) {
.subset2(.subset2(self, "database"), "get_row")(name)
.subset2(database, "get_row")(name)
},
get_record = function(name) {
record_from_row(
row = .subset2(self, "get_row")(name),
path_store = .subset2(self, "store")
row = get_row(name),
path_store = store
)
},
set_record = function(record) {
Expand All @@ -53,7 +53,7 @@ meta_class <- R6::R6Class(
self$database$buffer_row(record_produce_row(record))
},
insert_row = function(row) {
.subset2(.subset2(self, "database"), "buffer_row")(row)
.subset2(database, "buffer_row")(row)
},
exists_record = function(name) {
self$database$exists_row(name)
Expand Down
6 changes: 3 additions & 3 deletions R/class_outdated.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ outdated_class <- R6::R6Class(
counter_exists_name(self$outdated, name)
},
reset_hash = function(name) {
database <- .subset2(.subset2(self, "meta"), "database")
row <- database$get_row(name)
database <- .subset2(meta, "database")
row <- .subset2(database, "get_row")(name)
row$data <- NA_character_
database$set_row(row)
.subset2(database, "set_row")(row)
},
reset_junction = function(target) {
if (!is.null(target$junction)) {
Expand Down

0 comments on commit ed62f64

Please sign in to comment.