@@ -1745,13 +1745,16 @@ def __init__(self, descriptor, name, static, unforgeable, crossorigin=False):
1745
1745
and (MemberIsLegacyUnforgeable (m , descriptor ) == unforgeable or crossorigin )]
1746
1746
else :
1747
1747
methods = []
1748
- self .regular = [{"name" : m .identifier .name ,
1749
- "methodInfo" : not m .isStatic (),
1750
- "length" : methodLength (m ),
1751
- "flags" : "JSPROP_READONLY" if crossorigin else "JSPROP_ENUMERATE" ,
1752
- "condition" : PropertyDefiner .getControllingCondition (m , descriptor ),
1753
- "returnsPromise" : m .returnsPromise ()}
1754
- for m in methods ]
1748
+ self .regular = []
1749
+ for m in methods :
1750
+ method = self .methodData (m , descriptor , crossorigin )
1751
+
1752
+ if m .isStatic ():
1753
+ method ["nativeName" ] = CGDictionary .makeMemberName (
1754
+ descriptor .binaryNameFor (m .identifier .name , True )
1755
+ )
1756
+
1757
+ self .regular .append (method )
1755
1758
1756
1759
# TODO: Once iterable is implemented, use tiebreak rules instead of
1757
1760
# failing. Also, may be more tiebreak rules to implement once spec bug
@@ -1841,6 +1844,17 @@ def hasIterator(methods, regular):
1841
1844
self .unforgeable = unforgeable
1842
1845
self .crossorigin = crossorigin
1843
1846
1847
+ @staticmethod
1848
+ def methodData (m , descriptor , crossorigin ):
1849
+ return {
1850
+ "name" : m .identifier .name ,
1851
+ "methodInfo" : not m .isStatic (),
1852
+ "length" : methodLength (m ),
1853
+ "flags" : "JSPROP_READONLY" if crossorigin else "JSPROP_ENUMERATE" ,
1854
+ "condition" : PropertyDefiner .getControllingCondition (m , descriptor ),
1855
+ "returnsPromise" : m .returnsPromise ()
1856
+ }
1857
+
1844
1858
def generateArray (self , array , name ):
1845
1859
if len (array ) == 0 :
1846
1860
return ""
@@ -4233,7 +4247,7 @@ def makeNativeName(descriptor, method):
4233
4247
if method .underlyingAttr :
4234
4248
return CGSpecializedGetter .makeNativeName (descriptor , method .underlyingAttr )
4235
4249
name = method .identifier .name
4236
- nativeName = descriptor .binaryNameFor (name )
4250
+ nativeName = descriptor .binaryNameFor (name , method . isStatic () )
4237
4251
if nativeName == name :
4238
4252
nativeName = descriptor .internalNameFor (name )
4239
4253
return MakeNativeName (nativeName )
@@ -4357,7 +4371,7 @@ class CGStaticMethod(CGAbstractStaticBindingMethod):
4357
4371
"""
4358
4372
def __init__ (self , descriptor , method ):
4359
4373
self .method = method
4360
- name = method .identifier .name
4374
+ name = descriptor . binaryNameFor ( method .identifier .name , True )
4361
4375
CGAbstractStaticBindingMethod .__init__ (self , descriptor , name , templateArgs = ["D: DomTypes" ])
4362
4376
4363
4377
def generate_code (self ):
@@ -4395,7 +4409,7 @@ def definition_body(self):
4395
4409
@staticmethod
4396
4410
def makeNativeName (descriptor , attr ):
4397
4411
name = attr .identifier .name
4398
- nativeName = descriptor .binaryNameFor (name )
4412
+ nativeName = descriptor .binaryNameFor (name , attr . isStatic () )
4399
4413
if nativeName == name :
4400
4414
nativeName = descriptor .internalNameFor (name )
4401
4415
nativeName = MakeNativeName (nativeName )
@@ -4452,7 +4466,7 @@ def definition_body(self):
4452
4466
@staticmethod
4453
4467
def makeNativeName (descriptor , attr ):
4454
4468
name = attr .identifier .name
4455
- nativeName = descriptor .binaryNameFor (name )
4469
+ nativeName = descriptor .binaryNameFor (name , attr . isStatic () )
4456
4470
if nativeName == name :
4457
4471
nativeName = descriptor .internalNameFor (name )
4458
4472
return f"Set{ MakeNativeName (nativeName )} "
@@ -5745,7 +5759,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
5745
5759
(don't use this directly, use the derived classes below).
5746
5760
"""
5747
5761
def __init__ (self , descriptor , operation ):
5748
- nativeName = MakeNativeName (descriptor .binaryNameFor (operation ))
5762
+ nativeName = MakeNativeName (descriptor .binaryNameFor (operation , False ))
5749
5763
operation = descriptor .operations [operation ]
5750
5764
assert len (operation .signatures ()) == 1
5751
5765
signature = operation .signatures ()[0 ]
@@ -6535,7 +6549,7 @@ def definition_body(self):
6535
6549
else :
6536
6550
ctorName = GetConstructorNameForReporting (self .descriptor , self .constructor )
6537
6551
name = self .constructor .identifier .name
6538
- nativeName = MakeNativeName (self .descriptor .binaryNameFor (name ))
6552
+ nativeName = MakeNativeName (self .descriptor .binaryNameFor (name , True ))
6539
6553
6540
6554
if len (self .exposureSet ) == 1 :
6541
6555
args = [
@@ -7988,11 +8002,11 @@ def deps(self):
7988
8002
7989
8003
# We're always fallible
7990
8004
def callbackGetterName (attr , descriptor ):
7991
- return f"Get{ MakeNativeName (descriptor .binaryNameFor (attr .identifier .name ))} "
8005
+ return f"Get{ MakeNativeName (descriptor .binaryNameFor (attr .identifier .name , attr . isStatic () ))} "
7992
8006
7993
8007
7994
8008
def callbackSetterName (attr , descriptor ):
7995
- return f"Set{ MakeNativeName (descriptor .binaryNameFor (attr .identifier .name ))} "
8009
+ return f"Set{ MakeNativeName (descriptor .binaryNameFor (attr .identifier .name , attr . isStatic () ))} "
7996
8010
7997
8011
7998
8012
class CGCallbackFunction (CGCallback ):
@@ -8332,7 +8346,7 @@ def __init__(self, method, signature, descriptor):
8332
8346
jsName = method .identifier .name
8333
8347
CallbackOperationBase .__init__ (self , signature ,
8334
8348
jsName ,
8335
- MakeNativeName (descriptor .binaryNameFor (jsName )),
8349
+ MakeNativeName (descriptor .binaryNameFor (jsName , False )),
8336
8350
descriptor , descriptor .interface .isSingleOperationInterface ())
8337
8351
8338
8352
0 commit comments