mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 04:24:43 +00:00
Add Del
This commit is contained in:
parent
64be2da03b
commit
2f33c9b15d
9 changed files with 110 additions and 31 deletions
|
@ -16,7 +16,7 @@ use erg_parser::error::{ParserRunnerError, ParserRunnerErrors};
|
|||
|
||||
use erg_type::{Predicate, Type};
|
||||
|
||||
use crate::hir::Expr;
|
||||
use crate::hir::{Expr, Identifier};
|
||||
|
||||
/// dname is for "double under name"
|
||||
pub fn binop_to_dname(op: &str) -> &str {
|
||||
|
@ -1305,6 +1305,26 @@ impl LowerError {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn del_error(input: Input, errno: usize, ident: &Identifier, caused_by: AtomicStr) -> Self {
|
||||
let name = readable_name(ident.inspect());
|
||||
Self::new(
|
||||
ErrorCore::new(
|
||||
errno,
|
||||
NameError,
|
||||
ident.loc(),
|
||||
switch_lang!(
|
||||
"japanese" => format!("{YELLOW}{name}{RESET}は削除できません"),
|
||||
"simplified_chinese" => format!("{YELLOW}{name}{RESET}不能删除"),
|
||||
"traditional_chinese" => format!("{YELLOW}{name}{RESET}不能刪除"),
|
||||
"english" => format!("{YELLOW}{name}{RESET} cannot be deleted"),
|
||||
),
|
||||
None,
|
||||
),
|
||||
input,
|
||||
caused_by,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn visibility_error(
|
||||
input: Input,
|
||||
errno: usize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue