mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Remove some dead code from codegen as found by pyflakes.
This commit is contained in:
parent
4379809e88
commit
9d7478ab8a
2 changed files with 18 additions and 41 deletions
|
@ -9,7 +9,7 @@ import string
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
from WebIDL import *
|
from WebIDL import *
|
||||||
from Configuration import NoSuchDescriptorError, Descriptor
|
from Configuration import Descriptor
|
||||||
|
|
||||||
AUTOGENERATED_WARNING_COMMENT = \
|
AUTOGENERATED_WARNING_COMMENT = \
|
||||||
"/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
|
"/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
|
||||||
|
@ -498,9 +498,6 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
# they really should be!
|
# they really should be!
|
||||||
if exceptionCode is None:
|
if exceptionCode is None:
|
||||||
exceptionCode = "return 0;"
|
exceptionCode = "return 0;"
|
||||||
# We often want exceptionCode to be indented, since it often appears in an
|
|
||||||
# if body.
|
|
||||||
exceptionCodeIndented = CGIndenter(CGGeneric(exceptionCode))
|
|
||||||
|
|
||||||
# Unfortunately, .capitalize() on a string will lowercase things inside the
|
# Unfortunately, .capitalize() on a string will lowercase things inside the
|
||||||
# string, which we do not want.
|
# string, which we do not want.
|
||||||
|
@ -620,12 +617,6 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
failureCode)
|
failureCode)
|
||||||
return (template, declType, None, isOptional, None)
|
return (template, declType, None, isOptional, None)
|
||||||
|
|
||||||
# Sequences and callbacks have to hold a strong ref to the thing being
|
|
||||||
# passed down.
|
|
||||||
forceOwningType = descriptor.interface.isCallback() or isMember
|
|
||||||
|
|
||||||
typePtr = descriptor.nativeType
|
|
||||||
|
|
||||||
templateBody = ""
|
templateBody = ""
|
||||||
if descriptor.interface.isConsequential():
|
if descriptor.interface.isConsequential():
|
||||||
raise TypeError("Consequential interface %s being used as an "
|
raise TypeError("Consequential interface %s being used as an "
|
||||||
|
@ -648,7 +639,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
templateBody = wrapObjectTemplate(templateBody, isDefinitelyObject,
|
templateBody = wrapObjectTemplate(templateBody, isDefinitelyObject,
|
||||||
type, failureCode)
|
type, failureCode)
|
||||||
|
|
||||||
declType = CGGeneric(typePtr)
|
declType = CGGeneric(descriptor.nativeType)
|
||||||
if type.nullable() or isOptional:
|
if type.nullable() or isOptional:
|
||||||
declType = CGWrapper(declType, pre="Option<", post=">")
|
declType = CGWrapper(declType, pre="Option<", post=">")
|
||||||
|
|
||||||
|
@ -812,15 +803,9 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
assert not isOptional
|
assert not isOptional
|
||||||
|
|
||||||
typeName = CGDictionary.makeDictionaryName(type.inner)
|
typeName = CGDictionary.makeDictionaryName(type.inner)
|
||||||
actualTypeName = typeName
|
|
||||||
selfRef = "${declName}"
|
selfRef = "${declName}"
|
||||||
|
|
||||||
declType = CGGeneric(actualTypeName)
|
declType = CGGeneric(typeName)
|
||||||
|
|
||||||
# If we're a member of something else, the const
|
|
||||||
# will come from the Optional or our container.
|
|
||||||
if not isMember:
|
|
||||||
selfRef = "%s" % selfRef
|
|
||||||
|
|
||||||
# We do manual default value handling here, because we
|
# We do manual default value handling here, because we
|
||||||
# actually do want a jsval, and we only handle null anyway
|
# actually do want a jsval, and we only handle null anyway
|
||||||
|
@ -833,7 +818,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
template = ("%s = %s::new();\n"
|
template = ("%s = %s::new();\n"
|
||||||
"if %s.Init(cx, %s) == 0 {\n"
|
"if %s.Init(cx, %s) == 0 {\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
"}" % (selfRef, actualTypeName, selfRef, val))
|
"}" % (selfRef, typeName, selfRef, val))
|
||||||
|
|
||||||
return (template, declType, None, False, None)
|
return (template, declType, None, False, None)
|
||||||
|
|
||||||
|
@ -846,11 +831,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
if not type.isPrimitive():
|
if not type.isPrimitive():
|
||||||
raise TypeError("Need conversion for argument type '%s'" % str(type))
|
raise TypeError("Need conversion for argument type '%s'" % str(type))
|
||||||
|
|
||||||
conversionBehavior = "eDefault"
|
assert not isEnforceRange and not isClamp
|
||||||
if isEnforceRange:
|
|
||||||
conversionBehavior = "eEnforceRange"
|
|
||||||
elif isClamp:
|
|
||||||
conversionBehavior = "eClamp"
|
|
||||||
|
|
||||||
if failureCode is None:
|
if failureCode is None:
|
||||||
failureCode = 'return 0'
|
failureCode = 'return 0'
|
||||||
|
@ -934,8 +915,6 @@ def instantiateJSToNativeConversionTemplate(templateTuple, replacements,
|
||||||
|
|
||||||
originalDeclName = replacements["declName"]
|
originalDeclName = replacements["declName"]
|
||||||
if declType is not None:
|
if declType is not None:
|
||||||
if dealWithOptional:
|
|
||||||
mutableDeclType = CGWrapper(declType, pre="Option< ", post=" >")
|
|
||||||
newDecl = [CGGeneric("let mut "),
|
newDecl = [CGGeneric("let mut "),
|
||||||
CGGeneric(originalDeclName),
|
CGGeneric(originalDeclName),
|
||||||
CGGeneric(": "),
|
CGGeneric(": "),
|
||||||
|
@ -2246,7 +2225,6 @@ class CGCallGenerator(CGThing):
|
||||||
name = "(JSObject&)" + name
|
name = "(JSObject&)" + name
|
||||||
#XXXjdm Perhaps we should pass all nontrivial types by borrowed pointer
|
#XXXjdm Perhaps we should pass all nontrivial types by borrowed pointer
|
||||||
if a.type.isGeckoInterface():
|
if a.type.isGeckoInterface():
|
||||||
argDescriptor = descriptorProvider.getDescriptor(a.type.name)
|
|
||||||
if not (a.type.nullable() or a.optional):
|
if not (a.type.nullable() or a.optional):
|
||||||
name = "&mut " + name
|
name = "&mut " + name
|
||||||
elif a.type.isDictionary():
|
elif a.type.isDictionary():
|
||||||
|
@ -2906,15 +2884,12 @@ def getUnionTypeTemplateVars(type, descriptorProvider):
|
||||||
name = type.name
|
name = type.name
|
||||||
typeName = "/*" + type.name + "*/"
|
typeName = "/*" + type.name + "*/"
|
||||||
|
|
||||||
(template, declType, holderType,
|
(template, _, holderType,
|
||||||
dealWithOptional, initialValue) = getJSToNativeConversionTemplate(
|
dealWithOptional, initialValue) = getJSToNativeConversionTemplate(
|
||||||
type, descriptorProvider, failureCode="return Ok(None);",
|
type, descriptorProvider, failureCode="return Ok(None);",
|
||||||
exceptionCode='return Err(());',
|
exceptionCode='return Err(());',
|
||||||
isDefinitelyObject=True, isOptional=False)
|
isDefinitelyObject=True, isOptional=False)
|
||||||
|
|
||||||
structType = declType.define()
|
|
||||||
externalType = getUnionAccessorSignatureType(type, descriptorProvider).define()
|
|
||||||
|
|
||||||
assert not type.isObject()
|
assert not type.isObject()
|
||||||
jsConversion = string.Template(template).substitute({
|
jsConversion = string.Template(template).substitute({
|
||||||
"val": "value",
|
"val": "value",
|
||||||
|
@ -3546,7 +3521,6 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||||
operation = descriptor.operations[operation]
|
operation = descriptor.operations[operation]
|
||||||
assert len(operation.signatures()) == 1
|
assert len(operation.signatures()) == 1
|
||||||
signature = operation.signatures()[0]
|
signature = operation.signatures()[0]
|
||||||
extendedAttributes = descriptor.getExtendedAttributes(operation)
|
|
||||||
|
|
||||||
(returnType, arguments) = signature
|
(returnType, arguments) = signature
|
||||||
|
|
||||||
|
@ -4050,13 +4024,16 @@ class CGDescriptor(CGThing):
|
||||||
else:
|
else:
|
||||||
hasSetter = True
|
hasSetter = True
|
||||||
cgThings.append(CGMemberJITInfo(descriptor, m))
|
cgThings.append(CGMemberJITInfo(descriptor, m))
|
||||||
if hasMethod: cgThings.append(CGGenericMethod(descriptor))
|
if hasMethod:
|
||||||
if hasGetter: cgThings.append(CGGenericGetter(descriptor))
|
cgThings.append(CGGenericMethod(descriptor))
|
||||||
#if hasLenientGetter: cgThings.append(CGGenericGetter(descriptor,
|
if hasGetter:
|
||||||
# lenientThis=True))
|
cgThings.append(CGGenericGetter(descriptor))
|
||||||
if hasSetter: cgThings.append(CGGenericSetter(descriptor))
|
if hasLenientGetter:
|
||||||
#if hasLenientSetter: cgThings.append(CGGenericSetter(descriptor,
|
pass
|
||||||
# lenientThis=True))
|
if hasSetter:
|
||||||
|
cgThings.append(CGGenericSetter(descriptor))
|
||||||
|
if hasLenientSetter:
|
||||||
|
pass
|
||||||
|
|
||||||
if descriptor.concrete:
|
if descriptor.concrete:
|
||||||
cgThings.append(CGClassFinalizeHook(descriptor))
|
cgThings.append(CGClassFinalizeHook(descriptor))
|
||||||
|
|
|
@ -16,8 +16,8 @@ interface Blob {
|
||||||
readonly attribute unsigned long long size;
|
readonly attribute unsigned long long size;
|
||||||
readonly attribute DOMString type;
|
readonly attribute DOMString type;
|
||||||
|
|
||||||
Blob slice([Clamp] optional long long start,
|
Blob slice(/*[Clamp]*/ optional long long start,
|
||||||
[Clamp] optional long long end,
|
/*[Clamp]*/ optional long long end,
|
||||||
optional DOMString contentType);
|
optional DOMString contentType);
|
||||||
void close();
|
void close();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue