Skip to content

Commit

Permalink
Be more explicit in casts of generated bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ngsankha committed Feb 22, 2014
1 parent 061269f commit 47e6e6e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -250,7 +250,7 @@ def getPerSignatureCall(signature, argConversionStartsAt=0, signatureIndex=0):
# Doesn't matter which of the possible signatures we use, since
# they all have the same types up to that point; just use
# possibleSignatures[0]
caseBody = [CGGeneric("let argv_start = JS_ARGV(cx, cast::transmute(vp));")]
caseBody = [CGGeneric("let argv_start = JS_ARGV(cx, vp as *JSVal);")]
caseBody.extend([ CGArgumentConverter(possibleSignatures[0][1][i],
i, "argv_start", "argc",
descriptor) for i in
Expand Down Expand Up @@ -1481,7 +1481,7 @@ def setValue(value, callWrapValue=False):
"}\n" +
successCode)
else:
tail = "return JS_WrapValue(cx, cast::transmute(${jsvalPtr}));"
tail = "return JS_WrapValue(cx, ${jsvalPtr} as *JSVal);"
return ("${jsvalRef} = %s;\n" +
tail) % (value)

Expand Down Expand Up @@ -2802,7 +2802,7 @@ def definition_body(self):
return ptr::null();
}*/
/* Check to see whether the interface objects are already installed */
let protoOrIfaceArray: *mut *JSObject = cast::transmute(GetProtoOrIfaceArray(aGlobal));
let protoOrIfaceArray: *mut *JSObject = GetProtoOrIfaceArray(aGlobal) as *mut *JSObject;
let cachedObject: *JSObject = *protoOrIfaceArray.offset(%s as int);
if cachedObject.is_null() {
let tmp: *JSObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
Expand Down Expand Up @@ -3072,7 +3072,7 @@ def __init__(self, returnType, argsPre, arguments, nativeMethodName, static,
def getArgv(self):
return "argv" if self.argCount > 0 else ""
def getArgvDecl(self):
return "\nlet argv = JS_ARGV(cx, cast::transmute(vp));\n"
return "\nlet argv = JS_ARGV(cx, vp as *JSVal);\n"
def getArgc(self):
return "argc"
def getArguments(self):
Expand Down Expand Up @@ -3232,7 +3232,7 @@ def definition_body(self):

def getThis(self):
return CGIndenter(
CGGeneric("let obj: *JSObject = JS_THIS_OBJECT(cx, cast::transmute(vp));\n"
CGGeneric("let obj: *JSObject = JS_THIS_OBJECT(cx, vp as *mut JSVal);\n"
"if obj.is_null() {\n"
" return false as JSBool;\n"
"}\n"
Expand Down Expand Up @@ -3379,8 +3379,8 @@ def __init__(self, descriptor, lenientThis=False):
def generate_code(self):
return CGIndenter(CGGeneric(
"let undef = JSVAL_VOID;\n"
"let argv: *JSVal = if argc != 0 { JS_ARGV(cx, cast::transmute(vp)) } else { &undef as *JSVal };\n"
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, cast::transmute(vp)));\n"
"let argv: *JSVal = if argc != 0 { JS_ARGV(cx, vp as *JSVal) } else { &undef as *JSVal };\n"
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp as *JSVal));\n"
"if CallJitPropertyOp(info, cx, obj, this as *libc::c_void, argv) == 0 {"
" return 0;\n"
"}\n"
Expand Down Expand Up @@ -4364,7 +4364,7 @@ def getBody(self):
}
if hasProp != 0 {
return JS_GetPropertyById(cx, expando, id, cast::transmute(vp));
return JS_GetPropertyById(cx, expando, id, vp as *JSVal);
}
}"""

Expand Down Expand Up @@ -4402,7 +4402,7 @@ def getBody(self):
%s
let mut found = false;
if !GetPropertyOnPrototype(cx, proxy, id, &mut found, cast::transmute(vp)) {
if !GetPropertyOnPrototype(cx, proxy, id, &mut found, vp as *JSVal) {
return 0;
}
Expand Down

0 comments on commit 47e6e6e

Please sign in to comment.