Skip to content

Commit

Permalink
servo: Merge #1950 - Fix code generation for a null default value for…
Browse files Browse the repository at this point in the history
… nullable string arguments (from Ms2ger:nullable-string-with-null-default); r=jdm

Source-Repo: https://github.com/servo/servo
Source-Revision: 54da52fa774ce2ee59fcf811af595bf292169ad8
  • Loading branch information
Ms2ger committed Mar 21, 2014
1 parent 931e08e commit 03a48a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,7 @@ def getConversionCode(isOptional=False):

if isinstance(defaultValue, IDLNullValue):
assert(type.nullable())
return handleDefault(conversionCode,
"${declName}.SetNull();")
return handleDefault(conversionCode, "${declName} = None;")

value = "str::from_utf8(data).unwrap().to_owned()"
if type.nullable():
Expand Down
2 changes: 1 addition & 1 deletion servo/src/components/script/dom/testbinding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl TestBinding {
pub fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
// pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
pub fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JS<Blob>>) {}
pub fn PassOptionalAnyWithDefault(&self, _: *JSContext, _: JSVal) {}

Expand Down
2 changes: 1 addition & 1 deletion servo/src/components/script/dom/webidls/TestBinding.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface TestBinding {
void passOptionalNullableUnsignedLongWithDefault(optional unsigned long? arg = null);
void passOptionalNullableLongLongWithDefault(optional long long? arg = null);
void passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null);
// void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
void passOptionalNullableInterfaceWithDefault(optional Blob? arg = null);
void passOptionalAnyWithDefault(optional any arg = null);

Expand Down

0 comments on commit 03a48a0

Please sign in to comment.