Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of JS keyword for imported functions, types and statics, and when causing invalid code gen #4329

Merged
merged 19 commits into from
Dec 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow import for namespaces
RunDevelopment committed Dec 6, 2024
commit e4ba5435c6e880118fc5587cdd2efd3c71f2dc32
4 changes: 3 additions & 1 deletion crates/macro-support/src/parser.rs
Original file line number Diff line number Diff line change
@@ -426,7 +426,9 @@ impl Parse for BindgenAttr {
}
};

if is_js_keyword(&vals[0]) {
// We need to allow `import`, because of the `import.meta` namespace.
let first = &vals[0];
if is_js_keyword(first) && first != "import" {
let msg = format!("Namespace cannot start with the JS keyword `{}`", vals[0]);
return Err(syn::Error::new(spans[0], msg));
}