From 505e7d472a6607ab7d1e154bf8647c4862e2a208 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 28 Apr 2014 17:18:28 +0200 Subject: [PATCH] Use more rustic names for ThrowTypeError and infrastructure. --- .../dom/bindings/codegen/CodegenRust.py | 4 ++-- src/components/script/dom/bindings/error.rs | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 8eee27cd063..1efc517b9e0 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -176,7 +176,7 @@ class CGMethodCall(CGThing): if requiredArgs > 0: code = ( "if argc < %d {\n" - " ThrowTypeError(cx, \"Not enough arguments to %s.\");\n" + " throw_type_error(cx, \"Not enough arguments to %s.\");\n" " return 0;\n" "}" % (requiredArgs, methodName)) self.cgRoot.prepend( @@ -4340,7 +4340,7 @@ class CGBindingRoot(CGThing): 'dom::bindings::codegen::UnionTypes::*', 'dom::bindings::error::{FailureUnknown, Fallible, Error, ErrorResult}', 'dom::bindings::error::{throw_method_failed_with_details}', - 'dom::bindings::error::ThrowTypeError', + 'dom::bindings::error::throw_type_error', 'script_task::JSPageInfo', 'dom::bindings::proxyhandler', 'dom::bindings::proxyhandler::{_obj_toString, defineProperty}', diff --git a/src/components/script/dom/bindings/error.rs b/src/components/script/dom/bindings/error.rs index fae59d95342..bbfad388e4f 100644 --- a/src/components/script/dom/bindings/error.rs +++ b/src/components/script/dom/bindings/error.rs @@ -48,29 +48,30 @@ pub fn throw_not_in_union(cx: *JSContext, names: &'static str) -> JSBool { return 0; } -static ErrorFormatStringString: [libc::c_char, ..4] = [ +static ERROR_FORMAT_STRING_STRING: [libc::c_char, ..4] = [ '{' as libc::c_char, '0' as libc::c_char, '}' as libc::c_char, 0 as libc::c_char, ]; -static ErrorFormatString: JSErrorFormatString = struct_JSErrorFormatString { - format: &ErrorFormatStringString as *libc::c_char, +static ERROR_FORMAT_STRING: JSErrorFormatString = struct_JSErrorFormatString { + format: &ERROR_FORMAT_STRING_STRING as *libc::c_char, argCount: 1, exnType: JSEXN_TYPEERR as i16, }; -extern fn GetErrorMessage(_user_ref: *mut libc::c_void, _locale: *libc::c_char, - aErrorNumber: libc::c_uint) -> *JSErrorFormatString +extern fn get_error_message(_user_ref: *mut libc::c_void, + _locale: *libc::c_char, + error_number: libc::c_uint) -> *JSErrorFormatString { - assert_eq!(aErrorNumber, 0); - &ErrorFormatString as *JSErrorFormatString + assert_eq!(error_number, 0); + &ERROR_FORMAT_STRING as *JSErrorFormatString } -pub fn ThrowTypeError(cx: *JSContext, error: &str) { +pub fn throw_type_error(cx: *JSContext, error: &str) { let error = error.to_c_str(); error.with_ref(|error| unsafe { - JS_ReportErrorNumber(cx, GetErrorMessage, ptr::null(), 0, error); + JS_ReportErrorNumber(cx, get_error_message, ptr::null(), 0, error); }); }