Rename Full -> FullAst

This commit is contained in:
Joshua Warner 2024-08-10 13:20:54 -07:00
parent 3f7f1891f3
commit 0abea91796
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
9 changed files with 17 additions and 17 deletions

View file

@ -7,7 +7,7 @@ use roc_error_macros::{internal_error, user_error};
use roc_fmt::def::fmt_defs;
use roc_fmt::header::fmt_header;
use roc_fmt::Buf;
use roc_parse::ast::{Full, SpacesBefore};
use roc_parse::ast::{FullAst, SpacesBefore};
use roc_parse::header::parse_module_defs;
use roc_parse::remove_spaces::RemoveSpaces;
use roc_parse::{header, parser::SyntaxError, state::State};
@ -231,7 +231,7 @@ pub fn format_src(arena: &Bump, src: &str) -> Result<String, FormatProblem> {
Ok(buf.as_str().to_string())
}
fn parse_all<'a>(arena: &'a Bump, src: &'a str) -> Result<Full<'a>, SyntaxError<'a>> {
fn parse_all<'a>(arena: &'a Bump, src: &'a str) -> Result<FullAst<'a>, SyntaxError<'a>> {
let (header, state) = header::parse_header(arena, State::new(src.as_bytes()))
.map_err(|e| SyntaxError::Header(e.problem))?;
@ -239,7 +239,7 @@ fn parse_all<'a>(arena: &'a Bump, src: &'a str) -> Result<Full<'a>, SyntaxError<
let defs = parse_module_defs(arena, state, defs)?;
Ok(Full {
Ok(FullAst {
header: SpacesBefore {
before: header.before,
item: h,
@ -248,7 +248,7 @@ fn parse_all<'a>(arena: &'a Bump, src: &'a str) -> Result<Full<'a>, SyntaxError<
})
}
fn fmt_all<'a>(buf: &mut Buf<'a>, ast: &'a Full) {
fn fmt_all<'a>(buf: &mut Buf<'a>, ast: &'a FullAst) {
fmt_header(buf, &ast.header);
fmt_defs(buf, &ast.defs, 0);

View file

@ -15,7 +15,7 @@ use roc_module::ident::QualifiedModuleName;
use roc_region::all::{Loc, Position, Region};
#[derive(Debug, Clone)]
pub struct Full<'a> {
pub struct FullAst<'a> {
pub header: SpacesBefore<'a, Header<'a>>,
pub defs: Defs<'a>,
}
@ -2436,7 +2436,7 @@ pub trait Malformed {
fn is_malformed(&self) -> bool;
}
impl<'a> Malformed for Full<'a> {
impl<'a> Malformed for FullAst<'a> {
fn is_malformed(&self) -> bool {
self.header.item.is_malformed() || self.defs.is_malformed()
}

View file

@ -5,7 +5,7 @@ use roc_region::all::{Loc, Position, Region};
use crate::{
ast::{
AbilityImpls, AbilityMember, AssignedField, Collection, Defs, Expr, Full, Header,
AbilityImpls, AbilityMember, AssignedField, Collection, Defs, Expr, FullAst, Header,
Implements, ImplementsAbilities, ImplementsAbility, ImplementsClause, ImportAlias,
ImportAsKeyword, ImportExposingKeyword, ImportedModuleName, IngestedFileAnnotation,
IngestedFileImport, ModuleImport, ModuleImportParams, OldRecordBuilderField, Pattern,
@ -111,9 +111,9 @@ impl<'a, V: RemoveSpaces<'a>> RemoveSpaces<'a> for SpacesBefore<'a, V> {
}
}
impl<'a> RemoveSpaces<'a> for Full<'a> {
impl<'a> RemoveSpaces<'a> for FullAst<'a> {
fn remove_spaces(&self, arena: &'a Bump) -> Self {
Full {
FullAst {
header: self.header.remove_spaces(arena),
defs: self.defs.remove_spaces(arena),
}

View file

@ -1,7 +1,7 @@
use bumpalo::Bump;
use roc_fmt::{annotation::Formattable, header::fmt_header};
use roc_parse::{
ast::{Defs, Expr, Full, Header, Malformed, SpacesBefore},
ast::{Defs, Expr, FullAst, Header, Malformed, SpacesBefore},
header::parse_module_defs,
parser::{Parser, SyntaxError},
remove_spaces::RemoveSpaces,
@ -76,7 +76,7 @@ pub enum Output<'a> {
Expr(Expr<'a>),
Full(Full<'a>),
Full(FullAst<'a>),
}
impl<'a> Output<'a> {
@ -182,7 +182,7 @@ impl<'a> Input<'a> {
let defs = parse_module_defs(arena, state, defs)?;
Ok(Output::Full(Full { header, defs }))
Ok(Output::Full(FullAst { header, defs }))
}
}
}

View file

@ -1,5 +1,5 @@
Full(
Full {
FullAst {
header: SpacesBefore {
before: [],
item: App(

View file

@ -1,5 +1,5 @@
Full(
Full {
FullAst {
header: SpacesBefore {
before: [],
item: App(

View file

@ -1,5 +1,5 @@
Full(
Full {
FullAst {
header: SpacesBefore {
before: [],
item: App(

View file

@ -1,5 +1,5 @@
Full(
Full {
FullAst {
header: SpacesBefore {
before: [],
item: App(

View file

@ -1,5 +1,5 @@
Full(
Full {
FullAst {
header: SpacesBefore {
before: [],
item: App(