fix: throw error on duplicated let entry

This commit is contained in:
2026-01-10 01:22:39 +08:00
parent e29e432328
commit fdda1ae682
2 changed files with 22 additions and 7 deletions

View File

@@ -11,14 +11,17 @@ mimalloc = "0.1"
anyhow = "1.0"
rustyline = "14.0"
regex = "1.11"
hashbrown = "0.16"
derive_more = { version = "2", features = ["full"] }
thiserror = "2"
string-interner = "0.19"
itertools = "0.14"
pin-project = "1"
hashbrown = "0.16"
string-interner = "0.19"
thiserror = "2"
itertools = "0.14"
regex = "1.11"
deno_core = "0.376"
deno_error = "0.7"

View File

@@ -242,7 +242,13 @@ where
ast::Entry::Inherit(inherit) => {
for attr in inherit.attrs() {
if let ast::Attr::Ident(ident) = attr {
binding_syms.insert(ctx.new_sym(ident.to_string()));
let sym = ctx.new_sym(ident.to_string());
if !binding_syms.insert(sym) {
return Err(Error::downgrade_error(format!(
"attribute '{}' already defined",
format_symbol(ctx.get_sym(sym))
)));
}
}
}
}
@@ -251,7 +257,13 @@ where
if let Some(first_attr) = attrpath.attrs().next()
&& let ast::Attr::Ident(ident) = first_attr
{
binding_syms.insert(ctx.new_sym(ident.to_string()));
let sym = ctx.new_sym(ident.to_string());
if !binding_syms.insert(sym) {
return Err(Error::downgrade_error(format!(
"attribute '{}' already defined",
format_symbol(ctx.get_sym(sym))
)));
}
}
}
}