summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/RegExpConstructor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime/RegExpConstructor.cpp')
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index c79d5f8..24476d6 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -24,6 +24,7 @@
#include "ArrayPrototype.h"
#include "Error.h"
+#include "ExceptionHelpers.h"
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
@@ -294,7 +295,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
if (arg0.inherits(&RegExpObject::info)) {
if (!arg1.isUndefined())
- return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another.");
+ return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
return asObject(arg0);
}
@@ -303,13 +304,14 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
RefPtr<RegExp> regExp = RegExp::create(&exec->globalData(), pattern, flags);
if (!regExp->isValid())
- return throwError(exec, SyntaxError, makeString("Invalid regular expression: ", regExp->errorMessage()));
+ return throwError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage())));
return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
}
-static JSObject* constructWithRegExpConstructor(ExecState* exec, JSObject*, const ArgList& args)
+static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec)
{
- return constructRegExp(exec, args);
+ ArgList args(exec);
+ return JSValue::encode(constructRegExp(exec, args));
}
ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
@@ -319,10 +321,10 @@ ConstructType RegExpConstructor::getConstructData(ConstructData& constructData)
}
// ECMA 15.10.3
-static JSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
+static EncodedJSValue JSC_HOST_CALL callRegExpConstructor(ExecState* exec)
{
ArgList args(exec);
- return constructRegExp(exec, args);
+ return JSValue::encode(constructRegExp(exec, args));
}
CallType RegExpConstructor::getCallData(CallData& callData)