mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 877281 part 2. Eliminate uses of ${valPtr} in bindings conversions. r=peterv
This commit is contained in:
parent
1cf3024899
commit
089998b640
@ -2427,7 +2427,6 @@ class JSToNativeConversionInfo():
|
|||||||
template substitution performed on it as follows:
|
template 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
|
|
||||||
${valHandle} is a handle to the JS::Value in question
|
${valHandle} is a handle to the JS::Value in question
|
||||||
${valMutableHandle} is a mutable handle to the JS::Value in question
|
${valMutableHandle} is a mutable handle to the JS::Value in question
|
||||||
${holderName} replaced by the holder's name, if any
|
${holderName} replaced by the holder's name, if any
|
||||||
@ -2759,7 +2758,6 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
string.Template(elementInfo.template).substitute(
|
string.Template(elementInfo.template).substitute(
|
||||||
{
|
{
|
||||||
"val" : "temp",
|
"val" : "temp",
|
||||||
"valPtr": "temp.address()",
|
|
||||||
"valHandle": "temp",
|
"valHandle": "temp",
|
||||||
"valMutableHandle": "&temp",
|
"valMutableHandle": "&temp",
|
||||||
"declName" : "slot",
|
"declName" : "slot",
|
||||||
@ -2813,7 +2811,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
name = memberType.inner.identifier.name
|
name = memberType.inner.identifier.name
|
||||||
else:
|
else:
|
||||||
name = memberType.name
|
name = memberType.name
|
||||||
interfaceObject.append(CGGeneric("(failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext" % (unionArgumentObj, name)))
|
interfaceObject.append(CGGeneric("(failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valMutableHandle}, tryNext)) || !tryNext" % (unionArgumentObj, name)))
|
||||||
names.append(name)
|
names.append(name)
|
||||||
interfaceObject = CGWrapper(CGList(interfaceObject, " ||\n"), pre="done = ", post=";\n", reindent=True)
|
interfaceObject = CGWrapper(CGList(interfaceObject, " ||\n"), pre="done = ", post=";\n", reindent=True)
|
||||||
else:
|
else:
|
||||||
@ -2824,7 +2822,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
assert len(arrayObjectMemberTypes) == 1
|
assert len(arrayObjectMemberTypes) == 1
|
||||||
memberType = arrayObjectMemberTypes[0]
|
memberType = arrayObjectMemberTypes[0]
|
||||||
name = memberType.name
|
name = memberType.name
|
||||||
arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valMutableHandle}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
||||||
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)")
|
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)")
|
||||||
names.append(name)
|
names.append(name)
|
||||||
else:
|
else:
|
||||||
@ -2835,7 +2833,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
assert len(dateObjectMemberTypes) == 1
|
assert len(dateObjectMemberTypes) == 1
|
||||||
memberType = dateObjectMemberTypes[0]
|
memberType = dateObjectMemberTypes[0]
|
||||||
name = memberType.name
|
name = memberType.name
|
||||||
dateObject = CGGeneric("%s.SetTo%s(cx, ${val}, ${valPtr});\n"
|
dateObject = CGGeneric("%s.SetTo%s(cx, ${val}, ${valMutableHandle});\n"
|
||||||
"done = true;" % (unionArgumentObj, name))
|
"done = true;" % (unionArgumentObj, name))
|
||||||
dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, argObj)");
|
dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, argObj)");
|
||||||
names.append(name)
|
names.append(name)
|
||||||
@ -2847,7 +2845,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
assert len(callbackMemberTypes) == 1
|
assert len(callbackMemberTypes) == 1
|
||||||
memberType = callbackMemberTypes[0]
|
memberType = callbackMemberTypes[0]
|
||||||
name = memberType.name
|
name = memberType.name
|
||||||
callbackObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
callbackObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valMutableHandle}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
||||||
names.append(name)
|
names.append(name)
|
||||||
else:
|
else:
|
||||||
callbackObject = None
|
callbackObject = None
|
||||||
@ -2906,7 +2904,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
name = memberType.inner.identifier.name
|
name = memberType.inner.identifier.name
|
||||||
else:
|
else:
|
||||||
name = memberType.name
|
name = memberType.name
|
||||||
other = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
other = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valMutableHandle}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
|
||||||
names.append(name)
|
names.append(name)
|
||||||
if hasObjectTypes:
|
if hasObjectTypes:
|
||||||
other = CGWrapper(CGIndenter(other), "{\n", post="\n}")
|
other = CGWrapper(CGIndenter(other), "{\n", post="\n}")
|
||||||
@ -3703,8 +3701,6 @@ class CGArgumentConverter(CGThing):
|
|||||||
self.replacementVariables["val"] = string.Template(
|
self.replacementVariables["val"] = string.Template(
|
||||||
"args.handleAt(${index})"
|
"args.handleAt(${index})"
|
||||||
).substitute(replacer)
|
).substitute(replacer)
|
||||||
self.replacementVariables["valPtr"] = (
|
|
||||||
self.replacementVariables["val"] + ".address()")
|
|
||||||
self.replacementVariables["valHandle"] = self.replacementVariables["val"]
|
self.replacementVariables["valHandle"] = self.replacementVariables["val"]
|
||||||
self.replacementVariables["valMutableHandle"] = self.replacementVariables["val"]
|
self.replacementVariables["valMutableHandle"] = self.replacementVariables["val"]
|
||||||
if argument.treatUndefinedAs == "Missing":
|
if argument.treatUndefinedAs == "Missing":
|
||||||
@ -3777,7 +3773,6 @@ class CGArgumentConverter(CGThing):
|
|||||||
string.Template(typeConversion.template).substitute(
|
string.Template(typeConversion.template).substitute(
|
||||||
{
|
{
|
||||||
"val" : val,
|
"val" : val,
|
||||||
"valPtr": val + ".address()",
|
|
||||||
"valHandle" : val,
|
"valHandle" : val,
|
||||||
"valMutableHandle" : val,
|
"valMutableHandle" : val,
|
||||||
"declName" : "slot",
|
"declName" : "slot",
|
||||||
@ -5732,8 +5727,7 @@ return true;"""
|
|||||||
{
|
{
|
||||||
"val": "value",
|
"val": "value",
|
||||||
"valHandle": "value",
|
"valHandle": "value",
|
||||||
"valMutableHandle": "JS::MutableHandle<JS::Value>::fromMarkedLocation(pvalue)",
|
"valMutableHandle": "pvalue",
|
||||||
"valPtr": "pvalue",
|
|
||||||
"declName": "SetAs" + name + "()",
|
"declName": "SetAs" + name + "()",
|
||||||
"holderName": "m" + name + "Holder",
|
"holderName": "m" + name + "Holder",
|
||||||
}
|
}
|
||||||
@ -5742,7 +5736,7 @@ return true;"""
|
|||||||
post="\n"
|
post="\n"
|
||||||
"return true;")
|
"return true;")
|
||||||
setter = CGWrapper(CGIndenter(jsConversion),
|
setter = CGWrapper(CGIndenter(jsConversion),
|
||||||
pre="bool TrySetTo" + name + "(JSContext* cx, JS::Handle<JS::Value> value, JS::Value* pvalue, bool& tryNext)\n"
|
pre="bool TrySetTo" + name + "(JSContext* cx, JS::Handle<JS::Value> value, JS::MutableHandle<JS::Value> pvalue, bool& tryNext)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" tryNext = false;\n",
|
" tryNext = false;\n",
|
||||||
post="\n"
|
post="\n"
|
||||||
@ -6591,7 +6585,6 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
|||||||
"declName": argument.identifier.name,
|
"declName": argument.identifier.name,
|
||||||
"holderName": argument.identifier.name + "_holder",
|
"holderName": argument.identifier.name + "_holder",
|
||||||
"val": "desc->value",
|
"val": "desc->value",
|
||||||
"valPtr": "&desc->value",
|
|
||||||
"valHandle" : "JS::Handle<JS::Value>::fromMarkedLocation(&desc->value)",
|
"valHandle" : "JS::Handle<JS::Value>::fromMarkedLocation(&desc->value)",
|
||||||
"valMutableHandle" : "JS::MutableHandle<JS::Value>::fromMarkedLocation(&desc->value)",
|
"valMutableHandle" : "JS::MutableHandle<JS::Value>::fromMarkedLocation(&desc->value)",
|
||||||
"obj": "obj"
|
"obj": "obj"
|
||||||
@ -7799,7 +7792,6 @@ class CGDictionary(CGThing):
|
|||||||
def getMemberConversion(self, memberInfo):
|
def getMemberConversion(self, memberInfo):
|
||||||
(member, conversionInfo) = memberInfo
|
(member, conversionInfo) = memberInfo
|
||||||
replacements = { "val": "temp",
|
replacements = { "val": "temp",
|
||||||
"valPtr": "temp.address()",
|
|
||||||
"valHandle": "temp",
|
"valHandle": "temp",
|
||||||
"valMutableHandle": "&temp",
|
"valMutableHandle": "&temp",
|
||||||
"declName": self.makeMemberName(member.identifier.name),
|
"declName": self.makeMemberName(member.identifier.name),
|
||||||
@ -9421,7 +9413,6 @@ class CallbackMember(CGNativeMember):
|
|||||||
def getResultConversion(self):
|
def getResultConversion(self):
|
||||||
replacements = {
|
replacements = {
|
||||||
"val": "rval",
|
"val": "rval",
|
||||||
"valPtr": "rval.address()",
|
|
||||||
"valHandle": "rval",
|
"valHandle": "rval",
|
||||||
"valMutableHandle": "&rval",
|
"valMutableHandle": "&rval",
|
||||||
"holderName" : "rvalHolder",
|
"holderName" : "rvalHolder",
|
||||||
|
Loading…
Reference in New Issue
Block a user