swc_common

Module source_map

source
Expand description

The SourceMap tracks all the source code used within a single crate.

The mapping from integer byte positions to the original source code location is stored in spans.

Each bit of source parsed during crate parsing (typically files, in-memory strings, or various bits of macro expansion) cover a continuous range of bytes in the SourceMap and are represented by SourceFiles. Byte positions are stored in spans and used pervasively in the compiler. They are absolute positions within the SourceMap, which upon request can be converted to line and column information, source code snippets, etc.

Modules§

  • Machinery for hygienic macros, inspired by the MTWT[1] paper.

Structs§

Enums§

Constants§

  • Dummy span, both position and length are zero, syntax context is zero as well.
  • Used for some special cases. e.g. mark the generated AST.
  • PURE span, will emit /* #__PURE__ */ comment in codegen.

Statics§

  • Storage for span hygiene data.

Traits§

Type Aliases§