[ascoders] Debuggen mit resolve
- From: "Martin Fleck" <info@xxxxxxxxxxxxxxxxx>
- To: <ascoders@xxxxxxxxxxxxx>
- Date: Thu, 17 Apr 2003 02:15:12 +0200
hallo ascoders,
versuche gerade eine Art Debugger in ein Projekt einzubauen. Dazu leite ich
jeden Methodenaufruf über __resolve um, z.B. Aufruf this.myModel._setView
(this) ruft dann this.myModel.setView (this) auf. Wird eine unbekannte
Variable innerhalb von qModel aufgerufen "trace (this.xyz);" erhalte ich als
Rückgabe anstatt undefined den Wert [type Function]. Kann man dies noch
umgehen? Was haltet ihr generell davon? Danke.
-- >8 --
function qModel () {
trace ("*** qModel Object created");
this.onDebug();
trace(this.yxz);
};
qModel.prototype.setView = function (view) {
trace ("*** new Viewer inited");
};
qModel.prototype.onDebug = function () {
this.dMethods = [];
for (var i in this) {
if (typeof (this[i]) == "function") {
this.dMethods[i] = 1;
}
}
};
qModel.prototype.__resolve = function (name) {
return function () {
var name = name.substr (1);
var code = this.dMethods[name] ? -1 : 0;
if (code == -1) this[name].apply (this, arguments);
this.onDebug (name, arguments, code);
}
};
// --------------------------------
this.myModel = new qModel();
this.myModel.onDebug = function (name, args, code) {
var errors = [" // Methode nicht gefunden!"];
trace ("Debug: myModel." + name + " (" + args + ");" + errors[code]);
};
this.myModel._setView (this);
this.myModel._setController (this);
-- 8< --
--
Martin Fleck, http://action-script.com
------------------------------------------------------
Archiv : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------
- Follow-Ups:
- [ascoders] Re: Debuggen mit resolve
- From: bokel
- References:
Other related posts:
- » [ascoders] Debuggen mit resolve
- » [ascoders] Re: Debuggen mit resolve
- [ascoders] Re: Debuggen mit resolve
- From: bokel