SIGN IN SIGN UP

Deep copy modules in compiler

Previously, the compiler would mutate the parsed modules and store them as
output. This made it difficult to reason about the state of modules
constructed programatically in places like the REPL.

This change adds a Copy() function to the AST types that are stored by
reference. This allows the compiler to deep copy the parsed modules before
operating on them. This removes the challenge of reasoning about how the
compiler will behave when compiling the same input multiple times.

Various callers had to be modified to deal with the new calling convention.
Unit tests have been added to verify the new behaviour.

Fixes #158
T
Torin Sandall committed
1a01fe76d1cb7814a3ee1acf06fd46572540c0ea
Parent: 1545821