diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-06-10 03:50:42 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-06-10 03:50:42 -0600 |
commit | b46ab0c60d53461d639c74d9c6b39d0c6c2d78c9 (patch) | |
tree | cfc0b5cd4968b14a757c44b62bb6f0ab175c78e2 /components/script | |
parent | 6e0d0072b83bade910a6c2a0dee06d94f6f9fb17 (diff) | |
parent | e5b8e81bf8090bc563d6d0e226c76d9208fd797f (diff) | |
download | servo-b46ab0c60d53461d639c74d9c6b39d0c6c2d78c9.tar.gz servo-b46ab0c60d53461d639c74d9c6b39d0c6c2d78c9.zip |
Auto merge of #6319 - mukilan:overload-codegen, r=Ms2ger
The cause of the issue is that the index of the overload to be invoked was being derived from the wrong lists (that contain only a subset of the overloads) - `possibleOverloads` and `interfaceSigs` rather than the `method.signatures()` (which contains all possible overloads).
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6319)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index e33314c0f6d..cf7fcfd8e4c 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -177,14 +177,15 @@ class CGMethodCall(CGThing): requiredArgs -= 1 return requiredArgs - def getPerSignatureCall(signature, argConversionStartsAt=0, signatureIndex=0): + + signatures = method.signatures() + def getPerSignatureCall(signature, argConversionStartsAt=0): + signatureIndex = signatures.index(signature) return CGPerSignatureCall(signature[0], argsPre, signature[1], nativeMethodName + '_'*signatureIndex, static, descriptor, method, argConversionStartsAt) - - signatures = method.signatures() if len(signatures) == 1: # Special case: we can just do a per-signature method call # here for our one signature and not worry about switching @@ -215,12 +216,7 @@ class CGMethodCall(CGThing): if len(possibleSignatures) == 1: # easy case! signature = possibleSignatures[0] - - - sigIndex = signatures.index(signature) - argCountCases.append( - CGCase(str(argCount), getPerSignatureCall(signature, - signatureIndex=sigIndex))) + argCountCases.append(CGCase(str(argCount), getPerSignatureCall(signature))) continue distinguishingIndex = method.distinguishingIndexForArgCount(argCount) @@ -249,15 +245,12 @@ class CGMethodCall(CGThing): sigs = filter(filterLambda, possibleSignatures) assert len(sigs) < 2 if len(sigs) > 0: + call = getPerSignatureCall(sigs[0], distinguishingIndex) if condition is None: - caseBody.append( - getPerSignatureCall(sigs[0], distinguishingIndex, - possibleSignatures.index(sigs[0]))) + caseBody.append(call) else: caseBody.append(CGGeneric("if " + condition + " {")) - caseBody.append(CGIndenter( - getPerSignatureCall(sigs[0], distinguishingIndex, - possibleSignatures.index(sigs[0])))) + caseBody.append(CGIndenter(call)) caseBody.append(CGGeneric("}")) return True return False @@ -318,7 +311,7 @@ class CGMethodCall(CGThing): # distinguishingIndex + 1, since we already converted # distinguishingIndex. caseBody.append(CGIndenter( - getPerSignatureCall(sig, distinguishingIndex + 1, idx), 4)) + getPerSignatureCall(sig, distinguishingIndex + 1), 4)) caseBody.append(CGIndenter(CGGeneric("}"))) caseBody.append(CGGeneric("}")) |