Improved override
This commit is contained in:
@@ -54,7 +54,7 @@ pub enum TopLevelKind {
|
||||
visibility: Visibility,
|
||||
name: Identifier,
|
||||
generics: GenericsDecl,
|
||||
inherits: Option<TypeExpr>,
|
||||
inherits: Option<ExprPath>,
|
||||
fields: Vec<Spanned<FieldDeclStmt>>,
|
||||
constructor: Spanned<ClassConstructor>,
|
||||
items: Vec<ClassItem>,
|
||||
|
||||
@@ -294,7 +294,7 @@ class_item = _{
|
||||
}
|
||||
|
||||
class_decl = {
|
||||
visibility? ~ "class" ~ identifier ~ generics_decl? ~ (":" ~ type_expr)? ~ "{" ~ class_fields ~ class_constructor ~ class_item* ~ "}"
|
||||
visibility? ~ "class" ~ identifier ~ generics_decl? ~ (":" ~ expr_path)? ~ "{" ~ class_fields ~ class_constructor ~ class_item* ~ "}"
|
||||
}
|
||||
|
||||
// ======================================================
|
||||
|
||||
@@ -69,8 +69,8 @@ impl<'a> TryFrom<pest::iterators::Pair<'a, Rule>> for TopLevelKind {
|
||||
.transpose()
|
||||
.map(|v| v.unwrap_or_default()),
|
||||
|
||||
inherits: consume_rule(&mut inner, Rule::type_expr)
|
||||
.map(TypeExpr::try_from)
|
||||
inherits: consume_rule(&mut inner, Rule::expr_path)
|
||||
.map(ExprPath::try_from)
|
||||
.transpose(),
|
||||
|
||||
fields: collect_recovered(inner.next().unwrap().into_inner()),
|
||||
|
||||
Reference in New Issue
Block a user