File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,11 @@ define_wasm_features! {
286286 /// Corresponds to the 🛸 character in
287287 /// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
288288 pub cm_gc: CM_GC ( 1 << 33 ) = false ;
289+ /// Support for maps in the component model proposal.
290+ ///
291+ /// Corresponds to the 🗺️ character in
292+ /// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
293+ pub cm_map: CM_MAP ( 1 << 37 ) = false ;
289294
290295 /// Subset of the reference-types WebAssembly proposal which only
291296 /// encompasses the leb-encoding of the table immediate to the
Original file line number Diff line number Diff line change @@ -3920,10 +3920,18 @@ impl ComponentState {
39203920 crate :: ComponentDefinedType :: List ( ty) => Ok ( ComponentDefinedType :: List (
39213921 self . create_component_val_type ( ty, offset) ?,
39223922 ) ) ,
3923- crate :: ComponentDefinedType :: Map ( key, value) => Ok ( ComponentDefinedType :: Map (
3924- self . create_component_val_type ( key, offset) ?,
3925- self . create_component_val_type ( value, offset) ?,
3926- ) ) ,
3923+ crate :: ComponentDefinedType :: Map ( key, value) => {
3924+ if !self . features . cm_map ( ) {
3925+ bail ! (
3926+ offset,
3927+ "Maps require the component model map feature"
3928+ )
3929+ }
3930+ Ok ( ComponentDefinedType :: Map (
3931+ self . create_component_val_type ( key, offset) ?,
3932+ self . create_component_val_type ( value, offset) ?,
3933+ ) )
3934+ } ,
39273935 crate :: ComponentDefinedType :: FixedSizeList ( ty, elements) => {
39283936 if !self . features . cm_fixed_size_list ( ) {
39293937 bail ! (
You can’t perform that action at this time.
0 commit comments