Skip to content

[Feature] Preserve source mapping during codegen. Output source map from compilation for tooling like leo test. #29036

@mitchmindtree

Description

@mitchmindtree

🚀 Feature

It would be great if we had some source map available in the compiler output to give nicer feedback from leo test about failing tests.

This doesn't need to be some serialized form or file output - even just an in-memory mapping would be useful as leo tooling invokes the compiler as a library directly in memory anyway.

Motivation

Implementation

Currently, we track spans nicely throughout type-checking, however we appear to lose this info during code generation. Implementation might look something like:

  • Extend AleoStmt variants to include Span (or add a SpannedAleoStmt { span, stmt } struct).
  • Modify code generation (compiler/passes/src/code_generation/) to preserve spans.
  • Build an instruction/source map during compilation.
  • Include the source map in AleoProgram output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature.🔍 leo testAnything related to the `leo test` CLI command.🧱 Core CompilerAnything related to the core compiler including parsing, analysis, transforms, codegen, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions