@@ -181,7 +181,9 @@ impl Hash for PayloadInfo {
181
181
/// The different kinds of items that a module or an adapter can import.
182
182
///
183
183
/// This is intended to be an exhaustive definition of what can be imported into
184
- /// core modules within a component that wit-component supports.
184
+ /// core modules within a component that wit-component supports. This doesn't
185
+ /// get down to the level of storing any idx numbers; at its most specific, it
186
+ /// gives a name.
185
187
#[ derive( Debug , Clone ) ]
186
188
pub enum Import {
187
189
/// A top-level world function, with the name provided here, is imported
@@ -449,7 +451,8 @@ impl ImportMap {
449
451
& self . names
450
452
}
451
453
452
- /// Helper function used during validation to build up this `ImportMap`.
454
+ /// Classify an import and call `insert_import()` on it. Used during
455
+ /// validation to build up this `ImportMap`.
453
456
fn add (
454
457
& mut self ,
455
458
import : wasmparser:: Import < ' _ > ,
@@ -469,6 +472,11 @@ impl ImportMap {
469
472
self . insert_import ( import, item)
470
473
}
471
474
475
+ /// Determines what kind of thing is being imported: maps it from the
476
+ /// module/name/type triple in the raw wasm module to an enum.
477
+ ///
478
+ /// Handles a few special cases, then delegates to
479
+ /// `classify_component_model_import()`.
472
480
fn classify (
473
481
& self ,
474
482
import : wasmparser:: Import < ' _ > ,
@@ -980,6 +988,9 @@ impl ImportMap {
980
988
Ok ( true )
981
989
}
982
990
991
+ /// Map an imported item, by module and field name in `self.names`, to the
992
+ /// kind of `Import` it is: for example, a certain-typed function from an
993
+ /// adapter.
983
994
fn insert_import ( & mut self , import : wasmparser:: Import < ' _ > , item : Import ) -> Result < ( ) > {
984
995
let entry = self
985
996
. names
0 commit comments