From d0ba30a9303de7205265a1f9ae6ce56352ea7099 Mon Sep 17 00:00:00 2001 From: bburns632 Date: Tue, 23 Apr 2024 10:59:26 -0500 Subject: [PATCH] empty list handling in function reporter. R6 related. --- .github/workflows/release.yml | 2 +- R/FunctionReporter.R | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d63793..8902940 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 (#.#.#) diff --git a/R/FunctionReporter.R b/R/FunctionReporter.R index d8ca0c3..32b7c95 100644 --- a/R/FunctionReporter.R +++ b/R/FunctionReporter.R @@ -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 @@ -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 @@ -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)