From 3b8664e6ff977308ef67769de873f5ab27fa993c Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Wed, 29 Jul 2009 19:23:32 -0700 Subject: [PATCH] Disable typechecking by default --- Objective-J/debug.js | 107 -------------------------------------- Objective-J/preprocess.js | 8 ++- 2 files changed, 6 insertions(+), 109 deletions(-) diff --git a/Objective-J/debug.js b/Objective-J/debug.js index fddd7fed7..bd23ab7ae 100644 --- a/Objective-J/debug.js +++ b/Objective-J/debug.js @@ -182,110 +182,3 @@ function objj_debug_typecheck(expectedType, object) throw ("expected=" + expectedType + ", actual=" + actualType); } - -// profile decorator -/* -function objj_debug_profile(msgSend) -{ - return function(aReceiverOrSuper, aSelector) - { - var aReceiver = aReceiverOrSuper && (aReceiverOrSuper.receiver || aReceiverOrSuper); - - // profiling book keeping - var profileRecord = { - parent : objj_debug_profile, - receiver : aReceiver && GETMETA(aReceiver).name, - selector : aSelector, - calls : [] - } - objj_debug_profile.calls.push(profileRecord); - objj_debug_profile = profileRecord; - profileRecord.start = new Date(); - - try - { - return msgSend.apply(null, arguments); - } - finally - { - profileRecord.end = new Date(); - objj_debug_profile = profileRecord.parent; - } - } -} - -// FIXME: This could be much better. -var objj_debug_backtrace; - -function objj_backtrace_set_enabled(enabled) -{ - if (enabled) - { - objj_debug_backtrace = []; - objj_msgSend = objj_msgSend_Backtrace; - objj_msgSendSuper = objj_msgSendSuper_Backtrace; - } - else - { - objj_msgSend = objj_msgSend_Standard; - objj_msgSendSuper = objj_msgSendSuper_Standard; - } -} - -function objj_debug_print_backtrace() -{ - alert(objj_debug_backtrace_string()); -} - -function objj_debug_backtrace_string() -{ - return objj_debug_backtrace ? objj_debug_backtrace.join("\n") : ""; -} - -var objj_debug_profile = null, - objj_currently_profiling = false, - objj_profile_cleanup; - -function objj_profile(title) -{ - if (objj_currently_profiling) - return; - - var objj_msgSend_profile_saved = objj_msgSend, - objj_msgSendSuper_profile_saved = objj_msgSendSuper; - - objj_msgSend = objj_msgSend_Profile; - objj_msgSendSuper = objj_msgSendSuper_Profile; - - var root = { calls: [] }; - objj_debug_profile = root; - - var context = { - start : new Date(), - title : title, - profile : root - }; - - objj_profile_cleanup = function() { - objj_msgSend = objj_msgSend_profile_saved; - objj_msgSendSuper = objj_msgSendSuper_profile_saved; - context.end = new Date(); - return context; - } - - objj_currently_profiling = true; -} - -function objj_profileEnd() -{ - if (!objj_currently_profiling) - return; - - objj_debug_profile = null; - objj_currently_profiling = false; - - return objj_profile_cleanup(); -} -*/ - -objj_msgSend_set_decorators(objj_typecheck_decorator, objj_backtrace_decorator); diff --git a/Objective-J/preprocess.js b/Objective-J/preprocess.js index 0dd3cc93f..07de33827 100644 --- a/Objective-J/preprocess.js +++ b/Objective-J/preprocess.js @@ -20,7 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -var OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = 1 << 0; +var OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = 1 << 0, + OBJJ_PREPROCESSOR_TYPE_SIGNATURES = 1 << 1; function objj_preprocess(/*String*/ aString, /*objj_bundle*/ aBundle, /*objj_file*/ aSourceFile, /*unsigned*/ flags) { @@ -669,7 +670,10 @@ objj_preprocessor.prototype.method = function(tokens) CONCAT(buffer, ")\n{ with(self)\n{"); CONCAT(buffer, this.preprocess(tokens, NULL, TOKEN_CLOSE_BRACE, TOKEN_OPEN_BRACE)); - CONCAT(buffer, "}\n},"+JSON.stringify(types)+")"); + CONCAT(buffer, "}\n}"); + if (this._flags & OBJJ_PREPROCESSOR_TYPE_SIGNATURES) + CONCAT(buffer, ","+JSON.stringify(types)); + CONCAT(buffer, ")"); return buffer; }