diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-03-20 09:31:10 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-03-20 20:16:39 +0100 |
commit | 022dfa0a5efcf5452df75a366aa3c98fb6020c62 (patch) | |
tree | 6ac1282ff2c7ffa440419a604195891a406e96d3 /src/components/script/dom/bindings/codegen/CodegenRust.py | |
parent | 4ba093939a741d0ce01eaa5410a1c842a2baf219 (diff) | |
download | servo-022dfa0a5efcf5452df75a366aa3c98fb6020c62.tar.gz servo-022dfa0a5efcf5452df75a366aa3c98fb6020c62.zip |
Remove the preSuccess and postSuccess arguments to getJSToNativeConversionTemplate.
They were used for unions until 06f9afdad52cba426aedd45d0e08a7b2bdecc8f4.
Diffstat (limited to 'src/components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 598caed16ed..0b0e1471777 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -92,13 +92,8 @@ class CastableObjectUnwrapper(): codeOnFailure is the code to run if unwrapping fails. """ - def __init__(self, descriptor, source, target, codeOnFailure, isOptional=False, - preUnwrapped=None, postUnwrapped=None): + def __init__(self, descriptor, source, target, codeOnFailure, isOptional=False): assert descriptor.castable - - unwrappedVal = "val" - if preUnwrapped or postUnwrapped: - unwrappedVal = preUnwrapped + unwrappedVal + postUnwrapped self.substitution = { "type" : descriptor.nativeType, "depth": descriptor.interface.inheritanceDepth(), "prototype": "PrototypeList::id::" + descriptor.name, @@ -106,7 +101,7 @@ class CastableObjectUnwrapper(): "source" : source, "target" : target, "codeOnFailure" : CGIndenter(CGGeneric(codeOnFailure), 4).define(), - "unwrapped_val" : ("Some(%s)" % unwrappedVal) if isOptional else unwrappedVal, + "unwrapped_val" : "Some(val)" if isOptional else "val", "unwrapFn": "unwrap_jsmanaged" if 'JS' in descriptor.nativeType else "unwrap_object"} def __str__(self): @@ -428,9 +423,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, isClamp=False, exceptionCode=None, isCallbackReturnValue=False, - sourceDescription="value", - preSuccess=None, - postSuccess=None): + sourceDescription="value"): """ Get a template for converting a JS value to a native object based on the given type and descriptor. If failureCode is given, then we're actually @@ -654,8 +647,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, "(${val}).to_object()", "${declName}", failureCode, - isOptional or type.nullable(), - preUnwrapped=preSuccess, postUnwrapped=postSuccess)) + isOptional or type.nullable())) else: templateBody += str(FailureFatalCastableObjectUnwrapper( descriptor, @@ -886,15 +878,12 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, if failureCode is None: failureCode = 'return 0' - successVal = "v" - if preSuccess or postSuccess: - successVal = preSuccess + successVal + postSuccess #XXXjdm support conversionBehavior here template = ( "match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n" - " Ok(v) => ${declName} = %s,\n" + " Ok(v) => ${declName} = v,\n" " Err(_) => { %s }\n" - "}" % (successVal, exceptionCode)) + "}" % exceptionCode) declType = CGGeneric(builtinNames[type.tag()]) if type.nullable(): |