It's actually just an Ident.
This commit is contained in:
+2
-8
@@ -42,7 +42,7 @@ impl From<FnDef> for Stmt {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Let {
|
||||
pub name: Ident,
|
||||
pub ty: Option<Type>,
|
||||
pub ty: Option<Ident>,
|
||||
pub value: Expr,
|
||||
pub span: Span,
|
||||
}
|
||||
@@ -71,7 +71,7 @@ pub struct Block {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct FnParam {
|
||||
pub name: Ident,
|
||||
pub ty: Type,
|
||||
pub ty: Ident,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
@@ -124,9 +124,3 @@ pub struct Ident {
|
||||
pub name: String,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Type {
|
||||
pub name: String,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
+4
-6
@@ -1,9 +1,7 @@
|
||||
use std::iter::Peekable;
|
||||
|
||||
use crate::{
|
||||
ast::{
|
||||
Assign, Block, Expr, FnCall, FnDef, FnParam, Ident, Let, LitNumber, LitString, Stmt, Type,
|
||||
},
|
||||
ast::{Assign, Block, Expr, FnCall, FnDef, FnParam, Ident, Let, LitNumber, LitString, Stmt},
|
||||
lexer::Token,
|
||||
span::{Span, Spanned},
|
||||
};
|
||||
@@ -134,7 +132,7 @@ where
|
||||
};
|
||||
self.next_expected(Token::Colon)?;
|
||||
let param_type_token = self.next_expected(Token::Ident)?;
|
||||
let param_type = Type {
|
||||
let param_type = Ident {
|
||||
name: self.slice(*param_type_token.span())?.to_string(),
|
||||
span: *param_type_token.span(),
|
||||
};
|
||||
@@ -526,7 +524,7 @@ mod tests {
|
||||
name: "p1".to_string(),
|
||||
span: Span::new(7, 9),
|
||||
},
|
||||
ty: Type {
|
||||
ty: Ident {
|
||||
name: "Number".to_string(),
|
||||
span: Span::new(11, 17),
|
||||
},
|
||||
@@ -537,7 +535,7 @@ mod tests {
|
||||
name: "p2".to_string(),
|
||||
span: Span::new(19, 21),
|
||||
},
|
||||
ty: Type {
|
||||
ty: Ident {
|
||||
name: "String".to_string(),
|
||||
span: Span::new(23, 29),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user