Bug 1359269 - Part 9: Clean up codegen now that Clamp/EnforceRange can only be applied to types; r=bzbarsky
☠☠ backed out by 0c70617150d9 ☠ ☠
authorManish Goregaokar <manishearth@gmail.com>
Sat, 02 Mar 2019 01:23:30 +0000
changeset 519949 ae30401e7988d753acd0ae8f9086e9129b6bbb1e
parent 519948 8f9509e82439ccd4544624d7f52773698db3ea3c
child 519950 6c09eccc4bd1ac6feabc803d8bc8d769cc911599
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1359269
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1359269 - Part 9: Clean up codegen now that Clamp/EnforceRange can only be applied to types; r=bzbarsky Depends on D20059 Differential Revision: https://phabricator.services.mozilla.com/D20060
dom/bindings/Codegen.py
dom/bindings/parser/WebIDL.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -4566,18 +4566,16 @@ def recordKeyDeclType(recordType):
 # that will convert those to the actual return value of the callback function.
 def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
                                 isDefinitelyObject=False,
                                 isMember=False,
                                 isOptional=False,
                                 invalidEnumValueFatal=True,
                                 defaultValue=None,
                                 treatNullAs="Default",
-                                isEnforceRange=False,
-                                isClamp=False,
                                 isNullOrUndefined=False,
                                 exceptionCode=None,
                                 lenientFloatCode=None,
                                 allowTreatNonCallableAsNull=False,
                                 isCallbackReturnValue=False,
                                 sourceDescription="value",
                                 nestingLevel=""):
     """
@@ -4645,19 +4643,18 @@ def getJSToNativeConversionInfo(type, de
     assert defaultValue is None or not isOptional
 
     # Also, we should not have a defaultValue if we know we're an object
     assert not isDefinitelyObject or defaultValue is None
 
     # And we can't both be an object and be null or undefined
     assert not isDefinitelyObject or not isNullOrUndefined
 
-    # Types can also have extended attributes, copy them over
-    isClamp = isClamp or type.clamp
-    isEnforceRange = isEnforceRange or type.enforceRange
+    isClamp = type.clamp
+    isEnforceRange = type.enforceRange
     if type.treatNullAsEmpty:
         treatNullAs = "EmptyString"
 
     # If exceptionCode is not set, we'll just rethrow the exception we got.
     # Note that we can't just set failureCode to exceptionCode, because setting
     # failureCode will prevent pending exceptions from being set in cases when
     # they really should be!
     if exceptionCode is None:
@@ -6445,18 +6442,16 @@ class CGArgumentConverter(CGThing):
         typeConversion = getJSToNativeConversionInfo(
             self.argument.type,
             self.descriptorProvider,
             isOptional=(self.argcAndIndex is not None and
                         not self.argument.variadic),
             invalidEnumValueFatal=self.invalidEnumValueFatal,
             defaultValue=self.argument.defaultValue,
             treatNullAs=self.argument.treatNullAs,
-            isEnforceRange=self.argument.enforceRange,
-            isClamp=self.argument.clamp,
             lenientFloatCode=self.lenientFloatCode,
             isMember="Variadic" if self.argument.variadic else False,
             allowTreatNonCallableAsNull=self.argument.allowTreatNonCallableAsNull(),
             sourceDescription=self.argDescription)
 
         if not self.argument.variadic:
             return instantiateJSToNativeConversion(
                 typeConversion,
@@ -8618,22 +8613,16 @@ class FakeArgument():
         self.defaultValue = None
         self._allowTreatNonCallableAsNull = allowTreatNonCallableAsNull
         # For FakeArguments generated by maplike/setlike convenience functions,
         # we won't have an interfaceMember to pass in.
         if interfaceMember:
             self.treatNullAs = interfaceMember.treatNullAs
         else:
             self.treatNullAs = "Default"
-        if isinstance(interfaceMember, IDLAttribute):
-            self.enforceRange = interfaceMember.enforceRange
-            self.clamp = interfaceMember.clamp
-        else:
-            self.enforceRange = False
-            self.clamp = False
 
         self.identifier = FakeIdentifier(name)
 
     def allowTreatNonCallableAsNull(self):
         return self._allowTreatNonCallableAsNull
 
     def canHaveMissingValue(self):
         return False
@@ -13324,18 +13313,16 @@ class CGDictionary(CGThing):
         self.dictionary = dictionary
         self.descriptorProvider = descriptorProvider
         self.needToInitIds = len(dictionary.members) > 0
         self.memberInfo = [
             (member,
              getJSToNativeConversionInfo(
                  member.type,
                  descriptorProvider,
-                 isEnforceRange=member.enforceRange,
-                 isClamp=member.clamp,
                  isMember="Dictionary",
                  isOptional=member.canHaveMissingValue(),
                  defaultValue=member.defaultValue,
                  sourceDescription=self.getMemberSourceDescription(member)))
             for member in dictionary.members]
 
         # If we have a union member containing something in the same
         # file as us, bail: the C++ includes won't work out.
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -4197,18 +4197,16 @@ class IDLAttribute(IDLInterfaceMember):
         assert isinstance(type, IDLType)
         self.type = type
         self.readonly = readonly
         self.inherit = inherit
         self._static = static
         self.lenientThis = False
         self._unforgeable = False
         self.stringifier = stringifier
-        self.enforceRange = False
-        self.clamp = False
         self.slotIndices = None
         assert maplikeOrSetlike is None or isinstance(maplikeOrSetlike, IDLMaplikeOrSetlike)
         self.maplikeOrSetlike = maplikeOrSetlike
         self.dependsOn = "Everything"
         self.affects = "Everything"
         self.navigatorObjectGetter = navigatorObjectGetter
         self.bindingAliases = []
 
@@ -4596,18 +4594,16 @@ class IDLArgument(IDLObjectWithIdentifie
         assert isinstance(type, IDLType)
         self.type = type
 
         self.optional = optional
         self.defaultValue = defaultValue
         self.variadic = variadic
         self.dictionaryMember = dictionaryMember
         self._isComplete = False
-        self.enforceRange = False
-        self.clamp = False
         self._allowTreatNonCallableAsNull = False
         self._extendedAttrDict = {}
         self.allowTypeAttributes = allowTypeAttributes
 
         assert not variadic or optional
         assert not variadic or not defaultValue
 
     def addExtendedAttributes(self, attrs):