File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed 
packages/svelte/src/compiler/phases/2-analyze/visitors Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ ' svelte '  : patch 
3+ --- 
4+ 
5+ fix: correctly differentiate static fields before emitting ` duplicate_class_field ` 
Original file line number Diff line number Diff line change @@ -57,7 +57,10 @@ export function ClassBody(node, context) {
5757				e . state_field_duplicate ( node ,  name ) ; 
5858			} 
5959
60- 			const  _key  =  ( key . type  ===  'PrivateIdentifier'  ? '#'  : '' )  +  name ; 
60+ 			const  _key  = 
61+ 				( node . type  ===  'AssignmentExpression'  ||  ! node . static  ? ''  : '@' )  + 
62+ 				( key . type  ===  'PrivateIdentifier'  ? '#'  : '' )  + 
63+ 				name ; 
6164			const  field  =  fields . get ( _key ) ; 
6265
6366			// if there's already a method or assigned field, error 
@@ -91,7 +94,10 @@ export function ClassBody(node, context) {
9194			if  ( child . kind  ===  'constructor' )  { 
9295				constructor  =  child ; 
9396			}  else  if  ( ! child . computed )  { 
94- 				const  key  =  ( child . key . type  ===  'PrivateIdentifier'  ? '#'  : '' )  +  get_name ( child . key ) ; 
97+ 				const  key  = 
98+ 					( child . static  ? '@'  : '' )  + 
99+ 					( child . key . type  ===  'PrivateIdentifier'  ? '#'  : '' )  + 
100+ 					get_name ( child . key ) ; 
95101				const  field  =  fields . get ( key ) ; 
96102				if  ( ! field )  { 
97103					fields . set ( key ,  [ child . kind ] ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments