mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 13:41:10 +00:00
Impl: auto generating of new
This commit is contained in:
parent
e021ce71a7
commit
5029d71cbe
13 changed files with 401 additions and 88 deletions
|
@ -1872,13 +1872,17 @@ impl Identifier {
|
|||
Self::new(None, VarName::from_str_and_line(name, line))
|
||||
}
|
||||
|
||||
pub fn public_with_line(dot: Token, name: Str, line: usize) -> Self {
|
||||
Self::new(Some(dot), VarName::from_str_and_line(name, line))
|
||||
}
|
||||
|
||||
pub fn is_const(&self) -> bool {
|
||||
self.name.is_const()
|
||||
}
|
||||
|
||||
pub const fn vis(&self) -> Visibility {
|
||||
match &self.dot {
|
||||
Some(_dot) => Visibility::Public,
|
||||
Some(_) => Visibility::Public,
|
||||
None => Visibility::Private,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,6 +376,16 @@ impl Token {
|
|||
Self::from_str(TokenKind::Symbol, cont)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn symbol_with_line(cont: &str, line: usize) -> Self {
|
||||
Token {
|
||||
kind: TokenKind::Symbol,
|
||||
content: Str::rc(cont),
|
||||
lineno: line,
|
||||
col_begin: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn static_symbol(s: &'static str) -> Self {
|
||||
Token {
|
||||
kind: TokenKind::Symbol,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue