Table of Contents

TCodeUnit Class

Represents a complete Delphi unit with its type declarations, uses clauses, and implementation.

Syntax

Unit: Bcl.Code.MetaClasses

TCodeUnit = class(TCodeObject);

Methods

Name Description
UseUnit Adds a unit to the uses clause, avoiding duplicates.
FindType Searches for a type declaration by name.
FindAlias Searches for a type alias by name.
FindAliasByReference Searches for a type alias by the name of the type it references.

Properties

Name Description
Name Gets or sets the unit name.
_Types Gets the list of type declarations in this unit.
Aliases Gets the list of type alias declarations in this unit.
Functions Gets the list of standalone function declarations in this unit.
Variables Gets the list of global variable declarations in this unit.
Constants Gets the list of global constant declarations in this unit.
Initialization​Statements Gets the statements in the initialization section.
Finalization​Statements Gets the statements in the finalization section.
InterfaceUnits Gets the list of units in the interface uses clause.
ImplementationUnits Gets the list of units in the implementation uses clause.
Directives Gets the list of directives applied to this unit.