opt_dead_code: Optimizer: Dead Code Elimination.

Description Usage Arguments Examples

View source: R/opt-dead-code.R

Description

Performs one dead code elimination pass. Carefully examine the results after running this function!

Usage

1

Arguments

texts

A list of character vectors with the code to optimize.

Examples

1
2
3
4
5
6
7
8
code <- paste(
  "while (TRUE) {",
  "  break",
  "  dead_code()",
  "}",
  sep = "\n"
)
cat(opt_dead_code(list(code))$codes[[1]])

Example output

sh: 1: cannot create /dev/null: Permission denied
while (TRUE) {
  break
}

rco documentation built on April 17, 2021, 5:06 p.m.