Goal: each ir statement has a span linking back to the original source
Non goal: each ir expression has a span (can be a separate PR, and is less useful for analysis as we care mostly about constraints)
Changes:
factor a lot of the common ast code into zokrates_ast/src/common
make the ast more granular by introducing structs inside enum variants
add span on all structs and implement WithSpan trait for (almost) all AST nodes
refactor folders to provide some degree of automatic sourcemap propagation (implementing *_cases for expressions and statements allows to forget about the span and the output gets assigned to span of the input), though manual span setting is still required in many cases
add module_map at the program level to store the file names for sourcemaps
some smaller refactors:
remove immutable from typed
remove gt and ge from typed
~simplify zir identifier (it uses an enum with a single variant before this PR)~
rename number to value for {typed, zir}::FieldElementExpression and FlatExpression
Goal: each ir statement has a span linking back to the original source Non goal: each ir expression has a span (can be a separate PR, and is less useful for analysis as we care mostly about constraints)
Changes:
zokrates_ast/src/common
WithSpan
trait for (almost) all AST nodes*_cases
for expressions and statements allows to forget about the span and the output gets assigned to span of the input), though manual span setting is still required in many casesmodule_map
at the program level to store the file names for sourcemaps{typed, zir}::FieldElementExpression
andFlatExpression