mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
Add trim_end_proc_mark
This commit is contained in:
parent
055b6117ff
commit
855d463011
2 changed files with 19 additions and 2 deletions
|
@ -2295,6 +2295,13 @@ impl VarName {
|
|||
pub const fn inspect(&self) -> &Str {
|
||||
&self.0.content
|
||||
}
|
||||
|
||||
/// Remove `!` from the end of the identifier.
|
||||
/// Procedures defined in `d.er` automatically register the name without `!` as `py_name`.
|
||||
/// This method is for undoing it (e.g. pylyzer-mode)
|
||||
pub fn trim_end_proc_mark(&mut self) {
|
||||
let _ = self.0.content.trim_end_matches('!');
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -2378,6 +2385,10 @@ impl Identifier {
|
|||
pub fn is_procedural(&self) -> bool {
|
||||
self.name.is_procedural()
|
||||
}
|
||||
|
||||
pub fn trim_end_proc_mark(&mut self) {
|
||||
self.name.trim_end_proc_mark();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue