Skip to content
Merged
Show file tree
Hide file tree
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
Add hashmap macro to __exports
  • Loading branch information
palaviv committed Jul 20, 2019
commit 7226c925d2801efb1b310eb5683c8179f4b005c0
1 change: 1 addition & 0 deletions derive/src/compile_bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pub fn impl_py_compile_bytecode(input: TokenStream2) -> Result<TokenStream2, Dia
let output = quote! {
({
use ::rustpython_vm::__exports::bincode;
use ::rustpython_vm::__exports::hashmap;
hashmap! {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably add hashmap to __exports and use it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the __exports? This is my first time using procedural macro

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand what __exports do. Added hashmap

#(#modules),*
}
Expand Down
1 change: 1 addition & 0 deletions vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ pub use rustpython_bytecode::*;
#[doc(hidden)]
pub mod __exports {
pub use bincode;
pub use maplit::hashmap;
}
8 changes: 4 additions & 4 deletions wasm/lib/src/browser_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ pub fn setup_browser_module(vm: &VirtualMachine) {
vm.stdlib_inits
.borrow_mut()
.insert("_browser".to_string(), Box::new(make_module));
vm.frozen.borrow_mut().insert(
"browser".to_string(),
py_compile_bytecode!(file = "src/browser.py"),
);
vm.frozen.borrow_mut().extend(py_compile_bytecode!(
file = "src/browser.py",
module_name = "browser",
));
}