conlang: Remove "self" keyword
This commit is contained in:
@@ -285,7 +285,6 @@ pub struct Path {
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum PathPart {
|
||||
SuperKw,
|
||||
SelfKw,
|
||||
SelfTy,
|
||||
Ident(Sym),
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ use super::*;
|
||||
impl<T: AsRef<str>> From<T> for PathPart {
|
||||
fn from(value: T) -> Self {
|
||||
match value.as_ref() {
|
||||
"self" => PathPart::SelfKw,
|
||||
"super" => PathPart::SuperKw,
|
||||
ident => PathPart::Ident(ident.into()),
|
||||
}
|
||||
|
||||
@@ -370,7 +370,6 @@ impl Display for PathPart {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
PathPart::SuperKw => "super".fmt(f),
|
||||
PathPart::SelfKw => "self".fmt(f),
|
||||
PathPart::SelfTy => "Self".fmt(f),
|
||||
PathPart::Ident(id) => id.fmt(f),
|
||||
}
|
||||
|
||||
@@ -264,7 +264,6 @@ impl WeightOf for PathPart {
|
||||
fn weight_of(&self) -> usize {
|
||||
match self {
|
||||
PathPart::SuperKw => size_of_val(self),
|
||||
PathPart::SelfKw => size_of_val(self),
|
||||
PathPart::SelfTy => size_of_val(self),
|
||||
PathPart::Ident(interned) => interned.weight_of(),
|
||||
}
|
||||
|
||||
@@ -210,7 +210,6 @@ pub trait Fold {
|
||||
fn fold_path_part(&mut self, p: PathPart) -> PathPart {
|
||||
match p {
|
||||
PathPart::SuperKw => PathPart::SuperKw,
|
||||
PathPart::SelfKw => PathPart::SelfKw,
|
||||
PathPart::SelfTy => PathPart::SelfTy,
|
||||
PathPart::Ident(i) => PathPart::Ident(self.fold_sym(i)),
|
||||
}
|
||||
|
||||
@@ -464,7 +464,6 @@ impl Walk for PathPart {
|
||||
fn children<'a, V: Visit<'a>>(&'a self, v: &mut V) {
|
||||
match self {
|
||||
PathPart::SuperKw => {}
|
||||
PathPart::SelfKw => {}
|
||||
PathPart::SelfTy => {}
|
||||
PathPart::Ident(sym) => sym.visit_in(v),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user