@@ -98,16 +98,6 @@ - (JSObjCClassInfo*)classInfoForClass:(Class)cls;
9898 return result;
9999}
100100
101- static bool constructorHasInstance (JSContextRef ctx, JSObjectRef constructorRef, JSValueRef possibleInstance, JSValueRef*)
102- {
103- JSC::ExecState* exec = toJS (ctx);
104- JSC::APIEntryShim entryShim (exec);
105-
106- JSC::JSObject* constructor = toJS (constructorRef);
107- JSC::JSValue instance = toJS (exec, possibleInstance);
108- return JSC::JSObject::defaultHasInstance (exec, instance, constructor->get (exec, exec->propertyNames ().prototype ));
109- }
110-
111101static JSObjectRef makeWrapper (JSContextRef ctx, JSClassRef jsClass, id wrappedObject)
112102{
113103 JSC::ExecState* exec = toJS (ctx);
@@ -136,18 +126,6 @@ static JSObjectRef makeWrapper(JSContextRef ctx, JSClassRef jsClass, id wrappedO
136126 return [JSValue valueWithJSValueRef: result inContext: context];
137127}
138128
139- static JSValue *constructorWithCustomBrand (JSContext *context, NSString *brand, Class cls)
140- {
141- JSClassDefinition definition;
142- definition = kJSClassDefinitionEmpty ;
143- definition.className = [brand UTF8String ];
144- definition.hasInstance = constructorHasInstance;
145- JSClassRef classRef = JSClassCreate (&definition);
146- JSObjectRef result = makeWrapper ([context JSGlobalContextRef ], classRef, cls);
147- JSClassRelease (classRef);
148- return [JSValue valueWithJSValueRef: result inContext: context];
149- }
150-
151129// Look for @optional properties in the prototype containing a selector to property
152130// name mapping, separated by a __JS_EXPORT_AS__ delimiter.
153131static NSMutableDictionary *createRenameMap (Protocol *protocol, BOOL isInstanceMethod)
@@ -401,7 +379,7 @@ - (void)dealloc
401379static JSValue *allocateConstructorForCustomClass (JSContext *context, const char * className, Class cls)
402380{
403381 if (!supportsInitMethodConstructors ())
404- return constructorWithCustomBrand (context, [NSString stringWithFormat: @" %s Constructor" , className], cls);
382+ return objectWithCustomBrand (context, [NSString stringWithFormat: @" %s Constructor" , className], cls);
405383
406384 // For each protocol that the class implements, gather all of the init family methods into a hash table.
407385 __block HashMap<String, Protocol *> initTable;
@@ -447,7 +425,7 @@ - (void)dealloc
447425 JSObjectRef method = objCCallbackFunctionForInit (context, cls, initProtocol, initMethod, types);
448426 return [JSValue valueWithJSValueRef: method inContext: context];
449427 }
450- return constructorWithCustomBrand (context, [NSString stringWithFormat: @" %s Constructor" , className], cls);
428+ return objectWithCustomBrand (context, [NSString stringWithFormat: @" %s Constructor" , className], cls);
451429}
452430
453431- (void )allocateConstructorAndPrototypeWithSuperClassInfo : (JSObjCClassInfo*)superClassInfo
0 commit comments