Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for language changes #408

Merged
merged 1 commit into from May 2, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

update servo for language change

  • Loading branch information
aydinkim
aydinkim committed May 2, 2013
commit c1773f0c70e6efc49e108e1c612b510a1133bb50
@@ -2439,7 +2439,7 @@ def CreateBindingJSObject(descriptor, parent):
let handler = (*content).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint));
""" % descriptor.name
create = handler + """ let obj = NewProxyObject(aCx, *handler,
ptr::addr_of(&RUST_PRIVATE_TO_JSVAL(squirrel_away(aObject) as *libc::c_void)),
ptr::to_unsafe_ptr(&RUST_PRIVATE_TO_JSVAL(squirrel_away(aObject) as *libc::c_void)),
proto, %s,
ptr::null(), ptr::null());
if obj.is_null() {
@@ -2859,7 +2859,7 @@ def definition_body(self):
getPrototypeOf: ptr::null()
};
(*content).dom_static.proxy_handlers.insert(prototypes::id::%s as uint,
CreateProxyHandler(ptr::addr_of(&traps)));
CreateProxyHandler(ptr::to_unsafe_ptr(&traps)));
""" % self.descriptor.name
else:
@@ -3607,7 +3607,7 @@ def finalizeHook(descriptor, hookName, context):
else:
assert descriptor.nativeIsISupports
release = """let val = JS_GetReservedSlot(obj, 0);
let _: %s = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _: %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
""" % (descriptor.pointerType + descriptor.nativeType)
#return clearWrapper + release
return release
@@ -25,7 +25,7 @@ use dom::bindings::utils;

extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -77,7 +77,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
debug!("document finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _doc: @Document = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _doc: @Document = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
}
}

@@ -128,7 +128,7 @@ pub fn create(compartment: @mut Compartment, doc: @mut Document) -> *JSObject {
doc.wrapper.set_wrapper(instance.ptr);

unsafe {
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(doc));
let raw_ptr: *libc::c_void = cast::transmute(squirrel_away(doc));
JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}

@@ -240,7 +240,7 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
#[allow(non_implicitly_copyable_typarams)]
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -249,7 +249,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
match node.type_id() {
ElementNodeTypeId(HTMLImageElementTypeId) => {
do node.as_mut_element |elem| {
let arg = ptr::offset(JS_ARGV(cx, cast::reinterpret_cast(&vp)), 0);
let arg = ptr::offset(JS_ARGV(cx, cast::transmute(vp)), 0);
elem.set_attr(&str(~"width"),
&str((RUST_JSVAL_TO_INT(*arg) as int).to_str()))
}
@@ -264,7 +264,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa

extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -74,7 +74,7 @@ pub unsafe fn unwrap(obj: *JSObject) -> AbstractNode {
#[allow(non_implicitly_copyable_typarams)]
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -96,7 +96,7 @@ extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool
#[allow(non_implicitly_copyable_typarams)]
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -146,7 +146,7 @@ impl Node {

extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() {
return 0;
}
@@ -29,6 +29,7 @@ use core::cast;
use content::content_task::task_from_context;

use core::hashmap::HashMap;
use core::ptr::to_unsafe_ptr;

use dom::bindings::node;
use dom::node::AbstractNode;
@@ -64,7 +65,7 @@ extern fn InterfaceObjectToString(cx: *JSContext, _argc: uint, vp: *mut JSVal) -
}

let v = GetFunctionNativeReserved(callee, TOSTRING_CLASS_RESERVED_SLOT);
let clasp: *JSClass = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(*v));
let clasp: *JSClass = cast::transmute(RUST_JSVAL_TO_PRIVATE(*v));

let v = GetFunctionNativeReserved(callee, TOSTRING_NAME_RESERVED_SLOT);

@@ -125,7 +126,7 @@ pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
}

pub unsafe fn squirrel_away<T>(x: @mut T) -> *rust_box<T> {
let y: *rust_box<T> = cast::reinterpret_cast(&x);
let y: *rust_box<T> = cast::transmute(x);
cast::forget(x);
y
}
@@ -157,7 +158,7 @@ pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal {
}
&str(ref s) => {
str::as_buf(*s, |buf, len| {
let cbuf = cast::reinterpret_cast(&buf);
let cbuf = cast::transmute(buf);
RUST_STRING_TO_JSVAL(JS_NewStringCopyN(cx, cbuf, len as libc::size_t))
})
}
@@ -572,7 +573,7 @@ pub impl WrapperCache {
}

fn get_rootable(&self) -> **JSObject {
return ptr::addr_of(&self.wrapper);
return to_unsafe_ptr(&self.wrapper);
}

fn new() -> WrapperCache {
@@ -74,14 +74,14 @@ extern fn gc(cx: *JSContext, _argc: c_uint, _vp: *JSVal) -> JSBool {

unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
let val = JS_GetReservedSlot(obj, 0);
cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
cast::transmute(RUST_JSVAL_TO_PRIVATE(val))
}

extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
debug!("finalize!");
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _: @Window = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
let _: @Window = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
}
}

@@ -139,7 +139,7 @@ pub fn create(compartment: @mut Compartment, win: @mut Window) {
win.get_wrappercache().set_wrapper(obj.ptr);

unsafe {
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(win));
let raw_ptr: *libc::c_void = cast::transmute(squirrel_away(win));
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.