Disable typechecking by default

This commit is contained in:
Tom Robinson committed 2009-07-29 19:23:32 -07:00
1 parent 2bb6da5132
commit 3b8664e6ff
2 files changed
+6 -109

No files matched your search

-107
View File
@@ -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);
+6 -2
View File
@@ -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;
}