DefParts

tcmts.core.ir.DefParts · #3vfaizhl · type

A definition's IR in its parts. It's ["Def", tag, ...]: the head, then the syntax (body). After the tag, the head holds what isn't syntax, each only when the definition has it: its lineage salt (["Salt", path]: not a type's, nor a definition analyzed with no saltFor, as tests analyze code) and the JSX runtime it compiles to (["Jsx", runtime]). So the syntax starts at a different place in different definitions, analyzed or stored: read it through defParts (or ir.declarationOf, initializerOf), never by position.

import type { IR } from "#codebase/tcmts/core/hash";

export interface DefParts {
  tag: string;
  salt?: string;
  jsx?: string;
  /** everything before the syntax: `"Def"`, the tag, and the salt and JSX runtime if it has them */
  head: IR[];
  /** the syntax: the declaration (an overloaded function's signatures, then its implementation) */
  body: IR[];
}

uses

used by