aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-05-16 12:10:57 +0200
committerMs2ger <ms2ger@gmail.com>2014-05-16 12:10:57 +0200
commitfcd98e1c0db68a567efecaca6adaa31b41a5f03d (patch)
tree7df4bfa20fbbb92aa395a6e953c50fe808a92981 /src/components/script/dom/bindings/codegen
parent7abbef89196be4c6478ceb7408d5216e68385966 (diff)
downloadservo-fcd98e1c0db68a567efecaca6adaa31b41a5f03d.tar.gz
servo-fcd98e1c0db68a567efecaca6adaa31b41a5f03d.zip
Stop returning a default return value from getRetvalInfo.
This is now unused.
Diffstat (limited to 'src/components/script/dom/bindings/codegen')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py54
1 files changed, 18 insertions, 36 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 68f13ac780d..6dfb751051c 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -4311,50 +4311,38 @@ class CGNativeMember(ClassMethod):
The first element is the type declaration for the retval
- The second element is a default value that can be used on error returns.
- For cases whose behavior depends on isMember, the second element will be
- None if isMember is true.
-
- The third element is a template for actually returning a value stored in
+ The second element is a template for actually returning a value stored in
"${declName}". This means actually returning it if
we're not outparam, else assigning to the "retval" outparam. If
isMember is true, this can be None, since in that case the caller will
never examine this value.
"""
if type.isVoid():
- typeDecl, errorDefault, template = "", "", ""
+ typeDecl, template = "", ""
elif type.isPrimitive() and type.tag() in builtinNames:
result = CGGeneric(builtinNames[type.tag()])
- defaultReturnArg = "0"
if type.nullable():
result = CGTemplatedType("Nullable", result)
- defaultReturnArg = ""
- typeDecl, errorDefault, template = \
- (result.define(),
- "%s(%s)" % (result.define(), defaultReturnArg),
- "return ${declName};")
+ typeDecl, template = result.define(), "return ${declName};"
elif type.isDOMString():
if isMember:
# No need for a third element in the isMember case
- typeDecl, errorDefault, template = "nsString", None, None
+ typeDecl, template = "nsString", None
# Outparam
else:
- typeDecl, errorDefault, template = "void", "", "retval = ${declName};"
+ typeDecl, template = "void", "retval = ${declName};"
elif type.isByteString():
if isMember:
# No need for a third element in the isMember case
- typeDecl, errorDefault, template = "nsCString", None, None
+ typeDecl, template = "nsCString", None
# Outparam
- typeDecl, errorDefault, template = "void", "", "retval = ${declName};"
+ typeDecl, template = "void", "retval = ${declName};"
elif type.isEnum():
enumName = type.unroll().inner.identifier.name
if type.nullable():
enumName = CGTemplatedType("Nullable",
CGGeneric(enumName)).define()
- defaultValue = "%s()" % enumName
- else:
- defaultValue = "%s(0)" % enumName
- typeDecl, errorDefault, template = enumName, defaultValue, "return ${declName};"
+ typeDecl, template = enumName, "return ${declName};"
elif type.isGeckoInterface():
iface = type.unroll().inner;
nativeType = self.descriptorProvider.getDescriptor(
@@ -4369,24 +4357,21 @@ class CGNativeMember(ClassMethod):
# Since we always force an owning type for callback return values,
# our ${declName} is an OwningNonNull or nsRefPtr. So we can just
# .forget() to get our already_AddRefed.
- typeDecl, errorDefault, template = \
- result.define(), "nullptr", "return ${declName}.forget();"
+ typeDecl, template = result.define(), "return ${declName}.forget();"
elif type.isCallback():
- typeDecl, errorDefault, template = \
+ typeDecl, template = \
("already_AddRefed<%s>" % type.unroll().identifier.name,
- "nullptr", "return ${declName}.forget();")
+ "return ${declName}.forget();")
elif type.isAny():
- typeDecl, errorDefault, template = \
- "JS::Value", "JS::UndefinedValue()", "return ${declName};"
+ typeDecl, template = "JS::Value", "return ${declName};"
elif type.isObject():
- typeDecl, errorDefault, template = \
- "JSObject*", "nullptr", "return ${declName};"
+ typeDecl, template = "JSObject*", "return ${declName};"
elif type.isSpiderMonkeyInterface():
if type.nullable():
returnCode = "return ${declName}.IsNull() ? nullptr : ${declName}.Value().Obj();"
else:
returnCode = "return ${declName}.Obj();"
- typeDecl, errorDefault, template = "JSObject*", "nullptr", returnCode
+ typeDecl, template = "JSObject*", returnCode
elif type.isSequence():
# If we want to handle sequence-of-sequences return values, we're
# going to need to fix example codegen to not produce nsTArray<void>
@@ -4401,13 +4386,12 @@ class CGNativeMember(ClassMethod):
"}")
else:
returnCode = "retval.SwapElements(${declName});"
- typeDecl, errorDefault, template = "void", "", returnCode
+ typeDecl, template = "void", returnCode
elif type.isDate():
result = CGGeneric("Date")
if type.nullable():
result = CGTemplatedType("Nullable", result)
- typeDecl, errorDefault, template = \
- (result.define(), "%s()" % result.define(), "return ${declName};")
+ typeDecl, template = result.define(), "return ${declName};"
else:
raise TypeError("Don't know how to declare return value for %s" % type)
@@ -4416,11 +4400,9 @@ class CGNativeMember(ClassMethod):
typeDecl = "Fallible<%s>" % typeDecl
else:
typeDecl = "ErrorResult"
- if not errorDefault:
- errorDefault = "Err(FailureUnknown)"
if not template:
template = "return Ok(());"
- return typeDecl, errorDefault, template
+ return typeDecl, template
def getArgs(self, returnType, argList):
args = [self.getArg(arg) for arg in argList]
@@ -4861,7 +4843,7 @@ class CallbackMember(CGNativeMember):
assignRetval = string.Template(
self.getRetvalInfo(self.retvalType,
- False)[2]).substitute(replacements)
+ False)[1]).substitute(replacements)
return convertType.define() + "\n" + assignRetval + "\n"
def getArgConversions(self):