Replaced all the *Box with a generic LocBox<T>

This commit is contained in:
2024-12-22 02:17:43 +02:00
parent b8728b8f8d
commit d5f02cf1d5
15 changed files with 241 additions and 281 deletions

View File

@@ -1,10 +1,10 @@
use anyhow::Result;
use crate::{parser::Delimiter, tokeniser::Token};
use crate::{common::loc::LocBox, parser::Delimiter, tokeniser::Token};
use super::{ast::{typ::{Type, TypeBox}, TokenType}, expr::parse_expr, utils, Keyword, Punctuation};
use super::{ast::{typ::Type, TokenType}, expr::parse_expr, utils, Keyword, Punctuation};
pub fn parse_type(tokens: &mut Vec<Token>) -> Result<TypeBox> {
pub fn parse_type(tokens: &mut Vec<Token>) -> Result<LocBox<Type>> {
let mut ref_cnt = Vec::new();
let mut loc = None;
while let Some(tok) = utils::check_consume(tokens, TokenType::Punct(Punctuation::Ampersand)) {
@@ -60,5 +60,5 @@ pub fn parse_type(tokens: &mut Vec<Token>) -> Result<TypeBox> {
_ => unreachable!()
}
}
Ok(TypeBox::new(&loc.unwrap(), typ))
Ok(LocBox::new(&loc.unwrap(), typ))
}