This commit is contained in:
Shunsuke Shibayama 2022-10-03 21:44:59 +09:00
parent 64be2da03b
commit 2f33c9b15d
9 changed files with 110 additions and 31 deletions

View file

@ -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,