Skip to main content
This document explains how to work with local variables in Codegen.

Overview

Through the CodeBlock class, Codegen exposes APIs for analyzing and manipulating local variables within code blocks.

Basic Usage

Every code block (function body, loop body, etc.) provides access to its local variables:

Fuzzy Matching

Codegen supports fuzzy matching when searching for local variables. This allows you to find variables whose names contain a substring, rather than requiring exact matches:
Be careful with fuzzy matching when renaming variables, as it will replace the matched substring in all variable names. This might lead to unintended renames like config_settings becoming settings_settings.