Skip to content

Commit 99fc4d4

Browse files
committed
Clean up empty cases of new_needed_nFunctions
1 parent 94e24b0 commit 99fc4d4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

nCompiler/R/nCompile.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,15 @@ nCompile_createCppDefsInfo <- function(units,
217217
needed_nFunctions <- vector("list", length(units))
218218
for(i in seq_along(units)) {
219219
compileInfo <- compileInfos[[i]]
220+
needed_nFunctions[[i]] <- list()
220221
if(unitTypes[i] == "nF" || unitTypes[i] == "nF_noExport") {
221222
oneResult <- nCompile_nFunction(units[[i]],
222223
stopAfterCppDef = TRUE,
223224
env = env,
224225
compileInfo = compileInfo,
225226
control = control)
226227
cpp_names[i] <- NFinternals(units[[i]])$cpp_code_name
228+
needed_nFunctions[[i]] <- oneResult$needed_units$needed_nFunctions
227229
} else if(unitTypes[i] == "nCgen") {
228230
oneResult <- nCompile_nClass(units[[i]],
229231
stopAfterCppDef = TRUE,
@@ -235,7 +237,6 @@ nCompile_createCppDefsInfo <- function(units,
235237
if(!is.list(oneResult)) stop("nCompile_nFunction or nCompile_nClass did not return a list for ", cpp_names[i])
236238
unitResults[[i]] <- oneResult$cppDef
237239
needed_nClasses[[i]] <- oneResult$needed_units$needed_nClasses
238-
needed_nFunctions[[i]] <- oneResult$needed_units$needed_nFunctions
239240
}
240241
list(cppDefs = unitResults,
241242
cpp_names = cpp_names,
@@ -253,7 +254,7 @@ cppDefsList_2_RcppPacketList <- function(cppDefs) {
253254

254255
# prepare information for compilation units:
255256
#. names, interface type, unit types, inherits.
256-
# previously this was done inside nCompile, but
257+
# previously this was done inside nCompile, but
257258
# now we separate it so we can recurse on units
258259
# that need other units that then need prepared
259260
# information
@@ -316,7 +317,7 @@ nCompile_prepare_units <- function(...,
316317

317318
unitTypes <- get_nCompile_types(units)
318319

319-
# We defer processing of nClass inheritance until compile time to allow nClass
320+
# We defer processing of nClass inheritance until compile time to allow nClass
320321
# to be called with inherit = some_nClass before some_nClass is defined.
321322
for(i in seq_along(units)) {
322323
if(unitTypes[i] == "nCgen")
@@ -402,7 +403,7 @@ nCompile <- function(...,
402403
controlFull$always_include_units <- TRUE # Do this even if auto_include_units is FALSE, so we can error-trap
403404

404405
unit_info <- nCompile_prepare_units(...,
405-
interfaces = interfaces)
406+
interfaces = interfaces)
406407
new_units <- unit_info$units
407408
new_unitTypes <- unit_info$unitTypes
408409
new_interfaces <- unit_info$interfaces
@@ -425,6 +426,7 @@ nCompile <- function(...,
425426
cpp_names <- character()
426427

427428
while(!done_finding_units) {
429+
browser()
428430
cppDefs_info <- nCompile_createCppDefsInfo(new_units, new_unitTypes, controlFull, new_compileInfos)
429431
new_cppDefs <- cppDefs_info$cppDefs
430432
new_cpp_names <- cppDefs_info$cpp_names
@@ -1122,7 +1124,7 @@ WP_write_DESCRIPTION_NAMESPACE <- function(units, unitTypes, interfaces, createF
11221124
DESCRIPTION[1, "LinkingTo"] <- paste(DESCRIPTION[1, "LinkingTo"], "nCompiler", "RcppEigen",
11231125
#"RcppEigenAD",
11241126
"RcppParallel", "Rcereal", sep = ",")
1125-
# On Linux RcppParallel might need to be in both LinkingTo and Imports.
1127+
# On Linux RcppParallel might need to be in both LinkingTo and Imports.
11261128
# Having it in Imports allows the symbols to be found when the on-the-fly package is loaded.
11271129
# DESCRIPTION[1, "Imports"] <- paste(DESCRIPTION[1, "Imports"], "RcppParallel", sep = ",")
11281130
# DESCRIPTION$Encoding <- "UTF-8"

0 commit comments

Comments
 (0)