use crate::translation_utils::SignatureIndex;
use cranelift_entity::PrimaryMap;
use std::boxed::Box;

/// Contains information decoded from the Wasm module that must be referenced
/// during each Wasm function's translation.
///
/// This is only for data that is maintained by `cranelift-wasm` itself, as
/// opposed to being maintained by the embedder. Data that is maintained by the
/// embedder is represented with `ModuleEnvironment`.
#[derive(Debug)]
pub struct ModuleTranslationState {
    /// A map containing a Wasm module's original, raw signatures.
    ///
    /// This is used for translating multi-value Wasm blocks inside functions,
    /// which are encoded to refer to their type signature via index.
    pub(crate) wasm_types:
        PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>,
}

impl ModuleTranslationState {
    /// Creates a new empty ModuleTranslationState.
    pub fn new() -> Self {
        ModuleTranslationState {
            wasm_types: PrimaryMap::new(),
        }
    }
}

use crate::translation_utils::SignatureIndex;
use cranelift_entity::PrimaryMap;
use std::boxed::Box;

/// Contains information decoded from the Wasm module that must be referenced
/// during each Wasm function's translation.
///
/// This is only for data that is maintained by `cranelift-wasm` itself, as
/// opposed to being maintained by the embedder. Data that is maintained by the
/// embedder is represented with `ModuleEnvironment`.
#[derive(Debug)]
pub struct ModuleTranslationState {
    /// A map containing a Wasm module's original, raw signatures.
    ///
    /// This is used for translating multi-value Wasm blocks inside functions,
    /// which are encoded to refer to their type signature via index.
    pub(crate) wasm_types:
        PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>,
}

impl ModuleTranslationState {
    pub(crate) fn new() -> Self {
        ModuleTranslationState {
            wasm_types: PrimaryMap::new(),
        }
    }
}

--- 
+++ 
@@ -19,7 +19,8 @@
 }
 
 impl ModuleTranslationState {
-    pub(crate) fn new() -> Self {
+    /// Creates a new empty ModuleTranslationState.
+    pub fn new() -> Self {
         ModuleTranslationState {
             wasm_types: PrimaryMap::new(),
         }
[wasm] Make the ModuleTranslationState ctor public.

It's useful for consumers which don't want to translate a whole module,
but just need translation of functions.
