Skip to content

l0.MoonCats.Emitter

MoonCatsEmitter = require "l0.MoonCats.Emitter"
local MoonCatsEmitter = require("l0.MoonCats.Emitter")

MoonCatsEmitter

Emits LuaLS .d.lua type definitions from parsed module IRs.

Instance methods

emit

moonCatsEmitter\emit ir, packageSymbols, diagnostics
moonCatsEmitter:emit(ir, packageSymbols, diagnostics)

Emits the definition definition for one parsed module.

param type description
ir MoonCatsModuleIR The module IR produced by the parser.
packageSymbols? MoonCatsPackageSymbols Cross-module symbol context; omit for single-module runs.
diagnostics? MoonCatsDiagnostics Collection that receives findings discovered while emitting.

Returns:

  • definition string — The definition file's text.

Types

MoonCatsPackageSymbols

The cross-module context the emitter resolves identifier references against.

field type description
typeNameByRequireId table<string, string> LuaCATS type name each require identifier's export declares.
aliases table<string, boolean> Names of @alias declarations anywhere in the extraction run.