@@ -472,9 +472,9 @@ export class Compiler extends DiagnosticEmitter {
472472 if ( options . hasFeature ( Feature . MULTI_VALUE ) ) featureFlags |= FeatureFlags . MultiValue ;
473473 if ( options . hasFeature ( Feature . GC ) ) featureFlags |= FeatureFlags . GC ;
474474 if ( options . hasFeature ( Feature . MEMORY64 ) ) featureFlags |= FeatureFlags . Memory64 ;
475- if ( options . hasFeature ( Feature . FUNCTION_REFERENCES ) ) featureFlags |= FeatureFlags . FunctionReferences ;
476475 if ( options . hasFeature ( Feature . RELAXED_SIMD ) ) featureFlags |= FeatureFlags . RelaxedSIMD ;
477476 if ( options . hasFeature ( Feature . EXTENDED_CONST ) ) featureFlags |= FeatureFlags . ExtendedConst ;
477+ if ( options . hasFeature ( Feature . STRINGREF ) ) featureFlags |= FeatureFlags . Stringref ;
478478 module . setFeatures ( featureFlags ) ;
479479
480480 // set up the main start function
@@ -4870,6 +4870,10 @@ export class Compiler extends DiagnosticEmitter {
48704870 case TypeKind . EQREF :
48714871 case TypeKind . I31REF :
48724872 case TypeKind . DATAREF : return module . ref_eq ( leftExpr , rightExpr ) ;
4873+ case TypeKind . STRINGREF : return module . string_eq ( leftExpr , rightExpr ) ;
4874+ case TypeKind . STRINGVIEW_WTF8 :
4875+ case TypeKind . STRINGVIEW_WTF16 :
4876+ case TypeKind . STRINGVIEW_ITER :
48734877 case TypeKind . FUNCREF :
48744878 case TypeKind . EXTERNREF :
48754879 case TypeKind . ANYREF : {
@@ -4919,6 +4923,14 @@ export class Compiler extends DiagnosticEmitter {
49194923 module . ref_eq ( leftExpr , rightExpr )
49204924 ) ;
49214925 }
4926+ case TypeKind . STRINGREF : {
4927+ return module . unary ( UnaryOp . EqzI32 ,
4928+ module . string_eq ( leftExpr , rightExpr )
4929+ ) ;
4930+ }
4931+ case TypeKind . STRINGVIEW_WTF8 :
4932+ case TypeKind . STRINGVIEW_WTF16 :
4933+ case TypeKind . STRINGVIEW_ITER :
49224934 case TypeKind . FUNCREF :
49234935 case TypeKind . EXTERNREF :
49244936 case TypeKind . ANYREF : {
@@ -9836,6 +9848,13 @@ export class Compiler extends DiagnosticEmitter {
98369848 return this . checkFeatureEnabled ( Feature . REFERENCE_TYPES , reportNode )
98379849 && this . checkFeatureEnabled ( Feature . GC , reportNode ) ;
98389850 }
9851+ case TypeKind . STRINGREF :
9852+ case TypeKind . STRINGVIEW_WTF8 :
9853+ case TypeKind . STRINGVIEW_WTF16 :
9854+ case TypeKind . STRINGVIEW_ITER : {
9855+ return this . checkFeatureEnabled ( Feature . REFERENCE_TYPES , reportNode )
9856+ && this . checkFeatureEnabled ( Feature . STRINGREF , reportNode ) ;
9857+ }
98399858 }
98409859 let classReference = type . getClass ( ) ;
98419860 if ( classReference ) {
@@ -9941,7 +9960,11 @@ export class Compiler extends DiagnosticEmitter {
99419960 case TypeKind . EXTERNREF :
99429961 case TypeKind . ANYREF :
99439962 case TypeKind . EQREF :
9944- case TypeKind . DATAREF : return module . ref_null ( type . toRef ( ) ) ;
9963+ case TypeKind . DATAREF :
9964+ case TypeKind . STRINGREF :
9965+ case TypeKind . STRINGVIEW_WTF8 :
9966+ case TypeKind . STRINGVIEW_WTF16 :
9967+ case TypeKind . STRINGVIEW_ITER : return module . ref_null ( type . toRef ( ) ) ;
99459968 case TypeKind . I31REF : return module . i31_new ( module . i32 ( 0 ) ) ;
99469969 }
99479970 }
@@ -10090,7 +10113,11 @@ export class Compiler extends DiagnosticEmitter {
1009010113 case TypeKind . ANYREF :
1009110114 case TypeKind . EQREF :
1009210115 case TypeKind . I31REF :
10093- case TypeKind . DATAREF : {
10116+ case TypeKind . DATAREF :
10117+ case TypeKind . STRINGREF :
10118+ case TypeKind . STRINGVIEW_WTF8 :
10119+ case TypeKind . STRINGVIEW_WTF16 :
10120+ case TypeKind . STRINGVIEW_ITER : {
1009410121 // Needs to be true (i.e. not zero) when the ref is _not_ null,
1009510122 // which means `ref.is_null` returns false (i.e. zero).
1009610123 return module . unary ( UnaryOp . EqzI32 , module . ref_is_null ( expr ) ) ;
0 commit comments