MoonVeil-Docs/content/docs/options/flatten-control-flow.md
2025-05-02 02:25:57 -05:00

21 lines
1.1 KiB
Markdown

---
weight: 100
title: "Flatten control flow"
description: "Control flow flattener"
icon: "article"
date: "2025-05-01T18:47:58-05:00"
lastmod: "2025-05-01T18:47:58-05:00"
---
This option will enable the Control Flow Flattener (CFF). This feature is conservative in it's estimates of what can be flattened, if a block can't be flattened without side effects, it will be discarded from the flattening queue. CFF is applied recursively to failed blocks, meaning if a block is discarded from the flattening queue, its children may be flattened individually.
The control flow flattener supports the following branching syntaxes:
- `if` statements
- `while` and `repeat` loops
- numeric `for` loops
- `for-in` loops and even support for [Luau's generalized iteration](https://luau.org/syntax#generalized-iteration)
The following child options are available:
- `Wrap CFF blocks`: This will move some CFF blocks into their own closure in a lookup table.
- `Hoist locals`: Will move local storage into a lookup table for CFF blocks. Useful to cut down on the number of used locals.