Canonicalize ingested files directly instead of creating AST nodes

This commit is contained in:
Agus Zubiaga 2024-04-23 18:55:41 -03:00
parent a832de79d7
commit 7efc7a4a3e
No known key found for this signature in database
11 changed files with 146 additions and 121 deletions

View file

@ -1,5 +1,4 @@
use std::fmt::Debug;
use std::path::Path;
use crate::header::{
self, AppHeader, HostedHeader, InterfaceHeader, ModuleName, PackageHeader, PlatformHeader,
@ -391,9 +390,6 @@ pub enum Expr<'a> {
// Record Builders
RecordBuilder(Collection<'a, Loc<RecordBuilderField<'a>>>),
// The name of a file to be ingested directly into a variable.
IngestedFile(&'a Path, &'a Loc<TypeAnnotation<'a>>),
// Lookups
Var {
module_name: &'a str, // module_name will only be filled if the original Roc code stated something like `5 + SomeModule.myVar`, module_name will be blank if it was `5 + myVar`
@ -914,7 +910,6 @@ impl<'a, 'b> RecursiveValueDefIter<'a, 'b> {
| Str(_)
| SingleQuote(_)
| AccessorFunction(_)
| IngestedFile(_, _)
| Var { .. }
| Underscore(_)
| Crash
@ -2283,7 +2278,6 @@ impl<'a> Malformed for Expr<'a> {
Tag(_) |
OpaqueRef(_) |
SingleQuote(_) | // This is just a &str - not a bunch of segments
IngestedFile(_, _) |
EmptyDefsFinal |
Crash => false,