From 90f4d256cf9717a2849ef9bc54163f1f43762230 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 24 Apr 2014 21:50:20 +0200 Subject: [PATCH] Add support for dictionaries containing 'any'. --- src/components/script/dom/bindings/codegen/CodegenRust.py | 6 ++---- src/components/script/dom/webidls/TestBinding.webidl | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index cba5bd0b333..9062bfc92b4 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -765,10 +765,6 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, if type.isAny(): assert not isEnforceRange and not isClamp - if isMember: - raise TypeError("Can't handle member 'any'; need to sort out " - "rooting issues") - declType = CGGeneric("JSVal") value = CGGeneric("${val}") if isOptional: @@ -4236,6 +4232,8 @@ class CGDictionary(CGThing): return '~""' elif ty.startswith("Option"): return "None" + elif ty == "JSVal": + return "UndefinedValue()" else: return "/* uh oh: %s */" % ty diff --git a/src/components/script/dom/webidls/TestBinding.webidl b/src/components/script/dom/webidls/TestBinding.webidl index c0be2eaacd2..3c5962a5030 100644 --- a/src/components/script/dom/webidls/TestBinding.webidl +++ b/src/components/script/dom/webidls/TestBinding.webidl @@ -36,6 +36,7 @@ dictionary TestDictionaryDefaults { // double doubleValue = 7.0; DOMString stringValue = ""; // TestEnum enumValue = "bar"; + any anyValue = null; // boolean? nullableBooleanValue = false; // byte? nullableByteValue = 7;