-
Notifications
You must be signed in to change notification settings - Fork 745
codegen: Fix typedef re-export in namespaces when bindings aren't at the root. #436
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
Conversation
r? @fitzgen |
Fixes #433 |
The problem with rust-lang#425 was the following: We were parsing the methods after reaching the JS::Value definition. Those methods contained a JSWhyMagic that we hadn't seen, so we parsed it as being in the JS:: module.
There's just no advantage in doing so.
Can you also add this test case: namespace JS {
class Value;
}
typedef enum JSWhyMagic {} JSWhyMagic;
namespace JS {
class Value {
public:
void a(JSWhyMagic);
};
} |
That's the exact test case that is in tree already (for #410) |
:-/ When I try and compile the bindings generated from this test case I get:
|
I am getting this same error in the compilation of the SpiderMonkey bindings |
In tree it happens to compile because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see what was going on now. Thanks!
|
||
for _ in 0..root_import_depth(ctx, item) { | ||
path.push(super_.clone()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole function body could be
let super_ = ctx.rust_ident_raw("super");
let root = ctx.root_module().canonical_name(ctx);
let root_ident = ctx.rust_ident(&root);
iter::once(ctx.rust_ident_raw("self"))
.chain(iter::repeat(super_.clone()).take(root_import_depth(ctx, item)))
.chain(iter::once(root_ident))
.collect()
@bors-servo r+ |
📌 Commit d6fc044 has been approved by |
@bors-servo r- |
@bors-servo r+ |
📌 Commit d6fc044 has been approved by |
⚡ Test exempted - status |
codegen: Fix typedef re-export in namespaces when bindings aren't at the root.
No description provided.