mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 21:11:22 +00:00
Unsure about error
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
use proc_macro2::{Ident, Span};
|
||||
use shared;
|
||||
use syn;
|
||||
@ -21,7 +21,7 @@ pub struct Program {
|
||||
/// rust consts
|
||||
pub consts: Vec<Const>,
|
||||
/// rust submodules
|
||||
pub modules: HashMap<Ident, Module>,
|
||||
pub modules: BTreeMap<Ident, Module>,
|
||||
}
|
||||
|
||||
/// A rust to js interface. Allows interaction with rust objects/functions
|
||||
@ -227,8 +227,8 @@ pub enum ConstValue {
|
||||
///
|
||||
/// This exists to give the ability to namespace js imports.
|
||||
#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))]
|
||||
#[derive(Default)]
|
||||
pub struct Module {
|
||||
pub vis: syn::Visibility,
|
||||
/// js -> rust interfaces
|
||||
pub imports: Vec<Import>,
|
||||
}
|
||||
|
@ -1131,6 +1131,7 @@ impl<'a> TryToTokens for ModuleInIter<'a> {
|
||||
for i in imports.iter() {
|
||||
DescribeImport(&i.kind).to_tokens(tokens);
|
||||
}
|
||||
let vis = &self.module.vis;
|
||||
let mut body = TokenStream::new();
|
||||
for i in imports.iter() {
|
||||
if let Err(e) = i.kind.try_to_tokens(&mut body) {
|
||||
@ -1139,7 +1140,7 @@ impl<'a> TryToTokens for ModuleInIter<'a> {
|
||||
}
|
||||
Diagnostic::from_vec(errors)?;
|
||||
(quote!{
|
||||
pub mod #name {
|
||||
#vis mod #name {
|
||||
#body
|
||||
}
|
||||
}).to_tokens(tokens);
|
||||
|
Reference in New Issue
Block a user