mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
A function value converted to unknown on its own takes its name from the conversion site, but one held in a record, an array, a map or another converted value had no name there, so util.inspect printed `[Function (anonymous)]` where Node prints `[Function: toString]`. The function box now looks a nameless function up in a per-module table of (entry point, name) pairs, built from the functions the module makes closures of: each declared or lifted function's sourceName, which follows NamedEvaluation, and for an object literal's method its key (IrFunction.displayName). An adapter is looked up through the function it adapts. displayName is set only in modules that box a value that can hold a function, and the table exists only in modules that box functions.