mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Remove references to unused substitution variables in getJSToNativeConversionTemplate.
This commit is contained in:
parent
310d2a19bb
commit
2db1ce72f0
1 changed files with 1 additions and 26 deletions
|
@ -281,7 +281,6 @@ class CGMethodCall(CGThing):
|
||||||
isDefinitelyObject=True),
|
isDefinitelyObject=True),
|
||||||
{
|
{
|
||||||
"declName" : "arg%d" % distinguishingIndex,
|
"declName" : "arg%d" % distinguishingIndex,
|
||||||
"holderName" : ("arg%d" % distinguishingIndex) + "_holder",
|
|
||||||
"val" : distinguishingArg
|
"val" : distinguishingArg
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -449,9 +448,6 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
substitution performed on it as follows:
|
substitution performed on it as follows:
|
||||||
|
|
||||||
${val} replaced by an expression for the JS::Value in question
|
${val} replaced by an expression for the JS::Value in question
|
||||||
${valPtr} is a pointer to the JS::Value in question
|
|
||||||
${holderName} replaced by the holder's name, if any
|
|
||||||
${declName} replaced by the declaration's name
|
|
||||||
${haveValue} replaced by an expression that evaluates to a boolean
|
${haveValue} replaced by an expression that evaluates to a boolean
|
||||||
for whether we have a JS::Value. Only used when
|
for whether we have a JS::Value. Only used when
|
||||||
defaultValue is not None.
|
defaultValue is not None.
|
||||||
|
@ -460,15 +456,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||||
(declType). This is allowed to be None if the conversion code is
|
(declType). This is allowed to be None if the conversion code is
|
||||||
supposed to be used as-is.
|
supposed to be used as-is.
|
||||||
3) A boolean indicating whether the caller has to do optional-argument handling.
|
3) A boolean indicating whether the caller has to do optional-argument handling.
|
||||||
This will only be true if isOptional is true and if the returned template
|
|
||||||
expects both declType and holderType to be wrapped in Optional<>, with
|
|
||||||
${declName} and ${holderName} adjusted to point to the Value() of the
|
|
||||||
Optional, and Construct() calls to be made on the Optional<>s as needed.
|
|
||||||
|
|
||||||
${declName} must be in scope before the generated code is entered.
|
|
||||||
|
|
||||||
If holderType is not None then ${holderName} must be in scope
|
|
||||||
before the generated code is entered.
|
|
||||||
"""
|
"""
|
||||||
# If we have a defaultValue then we're not actually optional for
|
# If we have a defaultValue then we're not actually optional for
|
||||||
# purposes of what we need to be declared as.
|
# purposes of what we need to be declared as.
|
||||||
|
@ -945,13 +933,10 @@ class CGArgumentConverter(CGThing):
|
||||||
}
|
}
|
||||||
self.replacementVariables = {
|
self.replacementVariables = {
|
||||||
"declName" : "arg%d" % index,
|
"declName" : "arg%d" % index,
|
||||||
"holderName" : ("arg%d" % index) + "_holder"
|
|
||||||
}
|
}
|
||||||
self.replacementVariables["val"] = string.Template(
|
self.replacementVariables["val"] = string.Template(
|
||||||
"(*${argv}.offset(${index}))"
|
"(*${argv}.offset(${index}))"
|
||||||
).substitute(replacer)
|
).substitute(replacer)
|
||||||
self.replacementVariables["valPtr"] = (
|
|
||||||
"&" + self.replacementVariables["val"])
|
|
||||||
if argument.defaultValue:
|
if argument.defaultValue:
|
||||||
self.replacementVariables["haveValue"] = string.Template(
|
self.replacementVariables["haveValue"] = string.Template(
|
||||||
"${index} < ${argc}").substitute(replacer)
|
"${index} < ${argc}").substitute(replacer)
|
||||||
|
@ -2763,8 +2748,6 @@ def getUnionTypeTemplateVars(type, descriptorProvider):
|
||||||
assert not type.isObject()
|
assert not type.isObject()
|
||||||
jsConversion = string.Template(template).substitute({
|
jsConversion = string.Template(template).substitute({
|
||||||
"val": "value",
|
"val": "value",
|
||||||
"valPtr": None,
|
|
||||||
"holderName": None,
|
|
||||||
})
|
})
|
||||||
jsConversion = CGWrapper(CGGeneric(jsConversion), pre="Ok(Some(", post="))")
|
jsConversion = CGWrapper(CGGeneric(jsConversion), pre="Ok(Some(", post="))")
|
||||||
|
|
||||||
|
@ -3413,9 +3396,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
||||||
treatNullAs=argument.treatNullAs)
|
treatNullAs=argument.treatNullAs)
|
||||||
templateValues = {
|
templateValues = {
|
||||||
"declName": argument.identifier.name,
|
"declName": argument.identifier.name,
|
||||||
"holderName": argument.identifier.name + "_holder",
|
|
||||||
"val": "(*desc).value",
|
"val": "(*desc).value",
|
||||||
"valPtr": "&(*desc).value"
|
|
||||||
}
|
}
|
||||||
self.cgRoot.prepend(instantiateJSToNativeConversionTemplate(template, templateValues))
|
self.cgRoot.prepend(instantiateJSToNativeConversionTemplate(template, templateValues))
|
||||||
elif operation.isGetter():
|
elif operation.isGetter():
|
||||||
|
@ -4400,7 +4381,7 @@ class CGNativeMember(ClassMethod):
|
||||||
None if isMember is true.
|
None if isMember is true.
|
||||||
|
|
||||||
The third element is a template for actually returning a value stored in
|
The third element is a template for actually returning a value stored in
|
||||||
"${declName}" and "${holderName}". This means actually returning it if
|
"${declName}". This means actually returning it if
|
||||||
we're not outparam, else assigning to the "retval" outparam. 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
|
isMember is true, this can be None, since in that case the caller will
|
||||||
never examine this value.
|
never examine this value.
|
||||||
|
@ -4922,13 +4903,7 @@ class CallbackMember(CGNativeMember):
|
||||||
def getResultConversion(self):
|
def getResultConversion(self):
|
||||||
replacements = {
|
replacements = {
|
||||||
"val": "rval",
|
"val": "rval",
|
||||||
"mutableVal": "&rval",
|
|
||||||
"holderName" : "rvalHolder",
|
|
||||||
"declName" : "rvalDecl",
|
"declName" : "rvalDecl",
|
||||||
# We actually want to pass in a null scope object here, because
|
|
||||||
# wrapping things into our current compartment (that of mCallback)
|
|
||||||
# is what we want.
|
|
||||||
"obj": "nullptr"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if isJSImplementedDescriptor(self.descriptorProvider):
|
if isJSImplementedDescriptor(self.descriptorProvider):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue