walk_call_knitr: Code analysis for knitr reports.

View source: R/utils_knitr.R

walk_call_knitrR Documentation

Code analysis for knitr reports.

Description

Walk an abstract syntax tree and capture knitr dependencies.

Usage

walk_call_knitr(expr, counter)

Arguments

expr

A language object or function to scan.

counter

An internal counter object that keeps track of detected target names so far.

Details

For internal use only. Not a user-side function. Powers automatic detection of tar_load()/tar_read() dependencies in tar_render(). Packages codetools and CodeDepends have different (more sophisticated and elaborate) implementations of the concepts documented at https://adv-r.hadley.nz/expressions.html#ast-funs.

Value

A character vector of target names found during static code analysis.

Examples

# How tar_render() really works:
expr <- quote({
  if (a > 1) {
    tar_load(target_name)
  }
  process_stuff(target_name)
})
walk_ast(expr, walk_call_knitr)

wlandau/tarchetypes documentation built on Dec. 8, 2024, 4:44 p.m.