view ir

For debug.

View the compiled IR code for a block of code.

Command Type

built-in

Signature

> view ir {flags} (target)

Flags

  • --json, -j: Dump the raw block data as JSON (unstable).
  • --decl-id, -d: Integer is a declaration ID rather than a block ID.

Parameters

  • target: The name or block to view compiled code for.

Input/output types:

input output
nothing string

Notes

The target can be a closure, the name of a custom command, or an internal block ID. Closure literals within IR dumps often reference the block by ID (e.g. closure(3231)), so this provides an easy way to read the IR of any embedded closures.

The —decl-id option is provided to use a declaration ID instead, which can be found on call instructions. This is sometimes better than using the name, as the declaration may not be in scope.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.