diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/RegExpPrototype.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/RegExpPrototype.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp index a7c447d..106006c 100644 --- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -30,7 +30,6 @@ #include "JSStringBuilder.h" #include "JSValue.h" #include "ObjectPrototype.h" -#include "PrototypeFunction.h" #include "RegExpObject.h" #include "RegExp.h" #include "RegExpCache.h" @@ -48,13 +47,13 @@ static EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState*); // ECMA 15.10.5 -RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure) +RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* functionStructure) : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", "")) { - putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); - putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum); - putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum); - putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, globalObject, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum); + putDirectFunctionWithoutTransition(exec, new (exec) JSFunction(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); } // ------------------------------ Functions --------------------------- @@ -62,7 +61,7 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::s_info)) return throwVMTypeError(exec); return JSValue::encode(asRegExpObject(thisValue)->test(exec)); } @@ -70,7 +69,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec) EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::s_info)) return throwVMTypeError(exec); return JSValue::encode(asRegExpObject(thisValue)->exec(exec)); } @@ -78,14 +77,14 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec) EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::s_info)) return throwVMTypeError(exec); RefPtr<RegExp> regExp; JSValue arg0 = exec->argument(0); JSValue arg1 = exec->argument(1); - if (arg0.inherits(&RegExpObject::info)) { + if (arg0.inherits(&RegExpObject::s_info)) { if (!arg1.isUndefined()) return throwVMError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another.")); regExp = asRegExpObject(arg0)->regExp(); @@ -106,8 +105,8 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec) EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&RegExpObject::info)) { - if (thisValue.inherits(&RegExpPrototype::info)) + if (!thisValue.inherits(&RegExpObject::s_info)) { + if (thisValue.inherits(&RegExpPrototype::s_info)) return JSValue::encode(jsNontrivialString(exec, "//")); return throwVMTypeError(exec); } |