Skip to content

Handle file directive correctly #18

@hansihe

Description

@hansihe

The 'file' compiler directive is often used in generated code to specify a location in an origin file where the code was generated from. This needs to interact properly with diagnostics.

I'm thinking the best way of doing things would be to show compiler errors in the actual file, but display runtime errors in the origin file.

Unless you already had an implementation in mind, I think a decent way of doing things would be to store source span => origin file line mappings in an auxiliary data structure outside of the diagnostics itself, and reference that when generating debug information for the runtime.

Thoughts @bitwalker?

I implemented a stub implementation in preprocessor.rs in order to get code compiling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions