Skip to content

Commit b92e54c

Browse files
implement on a nest level
1 parent feb71f6 commit b92e54c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

R/relevel.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,19 @@ relocate_eq_assign <- function(pd) {
152152
#' @importFrom rlang seq2
153153
#' @keywords internal
154154
relocate_eq_assign_nest <- function(pd) {
155-
idx_eq_assign <- which(pd$token == "EQ_ASSIGN")
156-
if (length(idx_eq_assign) > 0) {
157-
block_id <- find_block_id(pd)
158-
blocks <- split(pd, block_id)
159-
pd <- map_dfr(blocks, relocate_eq_assign_one)
155+
if (any(pd$token == "equal_assign")) {
156+
pd
157+
} else {
158+
idx_eq_assign <- which(pd$token == "EQ_ASSIGN")
159+
if (length(idx_eq_assign) > 0) {
160+
block_id <- find_block_id(pd)
161+
blocks <- split(pd, block_id)
162+
pd <- map_dfr(blocks, relocate_eq_assign_one)
163+
}
164+
pd
160165
}
161-
pd
162166
}
163167

164-
165168
#' Find the block to which a token belongs
166169
#'
167170
#' Two assignment tokens `EQ_ASSIGN` belong to the same block if they are not

0 commit comments

Comments
 (0)