Skip to content

Commit

Permalink
empty list handling in function reporter. R6 related.
Browse files Browse the repository at this point in the history
  • Loading branch information
bburns632 committed Apr 23, 2024
1 parent fc032cb commit d0ba30a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Show Version Found
- name: Display Version Found
shell: bash
run: grep -E "Version:" $GITHUB_WORKSPACE/DESCRIPTION
- name: Test if it is a production pattern (#.#.#)
Expand Down
10 changes: 9 additions & 1 deletion R/FunctionReporter.R
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,10 @@ FunctionReporter <- R6::R6Class(
if (!is.list(x) && listable) {
xList <- as.list(x)

if (length(xList) > 0){

# Check if expression x is from _$_
if (identical(xList[[1]], quote(`$`))) {

# Check if expression x is of form self$foo, private$foo, or super$foo
# We want to keep those together because they could refer to the class'
# methods. So expression is not listable
Expand All @@ -654,6 +655,7 @@ FunctionReporter <- R6::R6Class(
|| identical(xList[[2]], quote(super))) {
listable <- FALSE


# If expression lefthand side is not keyword, we still want to split
# it up because left might be a function
# but we want to get rid of right, because it's a symbol in left's namespace
Expand All @@ -667,8 +669,14 @@ FunctionReporter <- R6::R6Class(
} else {
x <- xList
}
} else {
listable <- FALSE
}

}



if (listable){
# Filter out atomic values because we don't care about them
x <- Filter(f = Negate(is.atomic), x = x)
Expand Down

0 comments on commit d0ba30a

Please sign in to comment.