@@ -59,19 +59,21 @@ impl<'a> VM<'a> {
5959 FastOp :: GtEqInt if a. is_int ( ) && b. is_int ( ) => Val :: bool ( a. as_int ( ) >= b. as_int ( ) ) ,
6060 FastOp :: NotEqInt if a. is_int ( ) && b. is_int ( ) => Val :: bool ( a. as_int ( ) != b. as_int ( ) ) ,
6161
62- FastOp :: AddStr | FastOp :: EqStr if a. is_heap ( ) && b. is_heap ( ) => {
62+ FastOp :: EqStr if a. is_heap ( ) && b. is_heap ( ) => {
63+ match ( self . heap . get ( a) , self . heap . get ( b) ) {
64+ ( HeapObj :: Str ( x) , HeapObj :: Str ( y) ) => Val :: bool ( x == y) ,
65+ _ => return Ok ( FastOutcome :: TypeMiss ) ,
66+ }
67+ }
68+
69+ FastOp :: AddStr if a. is_heap ( ) && b. is_heap ( ) => {
6370 let ( sa, sb) = match ( self . heap . get ( a) , self . heap . get ( b) ) {
6471 ( HeapObj :: Str ( x) , HeapObj :: Str ( y) ) => ( x. clone ( ) , y. clone ( ) ) ,
6572 _ => return Ok ( FastOutcome :: TypeMiss ) ,
6673 } ;
67- match fast {
68- FastOp :: AddStr => {
69- let mut r = String :: with_capacity ( sa. len ( ) + sb. len ( ) ) ;
70- r. push_str ( & sa) ; r. push_str ( & sb) ;
71- self . heap . alloc ( HeapObj :: Str ( r) ) ?
72- }
73- _ => Val :: bool ( sa == sb) ,
74- }
74+ let mut r = String :: with_capacity ( sa. len ( ) + sb. len ( ) ) ;
75+ r. push_str ( & sa) ; r. push_str ( & sb) ;
76+ self . heap . alloc ( HeapObj :: Str ( r) ) ?
7577 }
7678
7779 _ => return Ok ( FastOutcome :: TypeMiss ) ,
0 commit comments