aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser/WebIDL.py
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-08-15 10:59:44 -0600
committerbors-servo <metajack+bors@gmail.com>2015-08-15 10:59:44 -0600
commit55e755e35ac8622a80cbebe3395aae44a0239b4f (patch)
treea46ead8edf8bb171f7444208cc94199f8e6672a2 /components/script/dom/bindings/codegen/parser/WebIDL.py
parenta1aed50b5a2686015bc3a17ec891a56eef8c1fc9 (diff)
parentec2a6b24b1e1317df5669d4b2f01a7c55bb31c75 (diff)
downloadservo-55e755e35ac8622a80cbebe3395aae44a0239b4f.tar.gz
servo-55e755e35ac8622a80cbebe3395aae44a0239b4f.zip
Auto merge of #7233 - nox:default-float-value, r=Ms2ger
Support default values for restricted float members (fixes #7217) <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7233) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen/parser/WebIDL.py')
-rw-r--r--components/script/dom/bindings/codegen/parser/WebIDL.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py
index a40c563ae35..5741ab8fce5 100644
--- a/components/script/dom/bindings/codegen/parser/WebIDL.py
+++ b/components/script/dom/bindings/codegen/parser/WebIDL.py
@@ -2920,8 +2920,7 @@ class IDLValue(IDLObject):
elif self.type.isInteger() and type.isFloat():
# Convert an integer literal into float
if -2**24 <= self.value <= 2**24:
- floatType = BuiltinTypes[IDLBuiltinType.Types.float]
- return IDLValue(self.location, floatType, float(self.value))
+ return IDLValue(self.location, type, float(self.value))
else:
raise WebIDLError("Converting value %s to %s will lose precision." %
(self.value, type), [location])
@@ -2939,7 +2938,7 @@ class IDLValue(IDLObject):
math.isnan(self.value))):
raise WebIDLError("Trying to convert unrestricted value %s to non-unrestricted"
% self.value, [location]);
- return self
+ return IDLValue(self.location, type, self.value)
elif self.type.isString() and type.isUSVString():
# Allow USVStrings to use default value just like
# DOMString. No coercion is required in this case as Codegen.py