Skip to content

Commit 0e8e725

Browse files
author
Francisco Tolmasky
committed
Fix for all ObjJ methods showing up as anonymous functions in Safari profiler.
[#266 state:resolved] Reviewed by me.
1 parent 831bbef commit 0e8e725

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Objective-J/runtime.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function class_addIvars(/*Class*/ aClass, /*Array*/ivars)
144144
var ivar = ivars[index],
145145
name = ivar.name;
146146

147-
if (typeof thePrototype[name] == "undefined")
147+
if (typeof thePrototype[name] === "undefined")
148148
{
149149
aClass.ivars.push(ivar);
150150
thePrototype[name] = NULL;
@@ -159,6 +159,8 @@ function class_copyIvarList(/*Class*/ aClass)
159159

160160
//#define class_copyIvarList(aClass) (aClass.ivars.slice(0))
161161

162+
#define METHOD_DISPLAY_NAME(aClass, aMethod) (ISMETA(aClass) ? '+' : '-') + " [" + class_getName(aClass) + ' ' + method_getName(aMethod) + ']'
163+
162164
function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementation, /*String*/aType)
163165
{
164166
if (aClass.method_hash[aName])
@@ -168,10 +170,13 @@ function class_addMethod(/*Class*/ aClass, /*SEL*/ aName, /*IMP*/ anImplementati
168170

169171
aClass.method_list.push(method);
170172
aClass.method_dtable[aName] = method;
171-
173+
174+
// Give this function a "pretty" name for the console.
175+
method.method_imp.displayName = METHOD_DISPLAY_NAME(aClass, method);
176+
172177
// FIXME: Should this be done here?
173178
// If this is a root class...
174-
if (!ISMETA(aClass) && GETMETA(aClass).isa == GETMETA(aClass))
179+
if (!ISMETA(aClass) && GETMETA(aClass).isa === GETMETA(aClass))
175180
class_addMethods(GETMETA(aClass), methods);
176181

177182
return YES;
@@ -194,10 +199,13 @@ function class_addMethods(/*Class*/ aClass, /*Array*/ methods)
194199

195200
method_list.push(method);
196201
method_dtable[method.name] = method;
202+
203+
// Give this function a "pretty" name for the console.
204+
method.method_imp.displayName = METHOD_DISPLAY_NAME(aClass, method);
197205
}
198206

199207
// If this is a root class...
200-
if (!ISMETA(aClass) && GETMETA(aClass).isa == GETMETA(aClass))
208+
if (!ISMETA(aClass) && GETMETA(aClass).isa === GETMETA(aClass))
201209
class_addMethods(GETMETA(aClass), methods);
202210
}
203211

@@ -520,7 +528,7 @@ function sel_getUid(/*String*/ aName)
520528

521529
function sel_isEqual(/*SEL*/ lhs, /*SEL*/ rhs)
522530
{
523-
return lhs == rhs;
531+
return lhs === rhs;
524532
}
525533

526534
function sel_registerName(aName)

0 commit comments

Comments
 (0)