#include "RegExpConstructor.h"
#include "Error.h"
+#include "Operations.h"
#include "RegExpMatchesArray.h"
#include "RegExpPrototype.h"
+#if PLATFORM(IOS)
#include <wtf/PassOwnPtr.h>
+#endif
namespace JSC {
-static JSValue regExpConstructorInput(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorMultiline(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorLastMatch(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorLastParen(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorLeftContext(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorRightContext(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar1(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar2(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar3(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar4(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar5(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar6(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar7(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar8(ExecState*, JSValue, const Identifier&);
-static JSValue regExpConstructorDollar9(ExecState*, JSValue, const Identifier&);
+static JSValue regExpConstructorInput(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorMultiline(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorLastMatch(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorLastParen(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorLeftContext(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorRightContext(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar1(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar2(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar3(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar4(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar5(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar6(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar7(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar8(ExecState*, JSValue, PropertyName);
+static JSValue regExpConstructorDollar9(ExecState*, JSValue, PropertyName);
static void setRegExpConstructorInput(ExecState*, JSObject*, JSValue);
static void setRegExpConstructorMultiline(ExecState*, JSObject*, JSValue);
namespace JSC {
-ASSERT_CLASS_FITS_IN_CELL(RegExpConstructor);
-
const ClassInfo RegExpConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::regExpConstructorTable, CREATE_METHOD_TABLE(RegExpConstructor) };
/* Source for RegExpConstructor.lut.h
RegExpConstructor::RegExpConstructor(JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype)
: InternalFunction(globalObject, structure)
- , m_cachedResult(globalObject->globalData(), this, regExpPrototype->regExp())
+ , m_cachedResult(globalObject->vm(), this, regExpPrototype->regExp())
, m_multiline(false)
{
}
void RegExpConstructor::finishCreation(ExecState* exec, RegExpPrototype* regExpPrototype)
{
- Base::finishCreation(exec->globalData(), Identifier(exec, "RegExp"));
+ Base::finishCreation(exec->vm(), Identifier(exec, "RegExp").string());
ASSERT(inherits(&s_info));
// ECMA 15.10.5.1 RegExp.prototype
- putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
+ putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, regExpPrototype, DontEnum | DontDelete | ReadOnly);
// no. of arguments for constructor
- putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
+ putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
}
void RegExpConstructor::destroy(JSCell* cell)
{
- jsCast<RegExpConstructor*>(cell)->RegExpConstructor::~RegExpConstructor();
+ static_cast<RegExpConstructor*>(cell)->RegExpConstructor::~RegExpConstructor();
}
void RegExpConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
return m_cachedResult.lastResult(exec, this)->rightContext(exec);
}
-bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+bool RegExpConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
return getStaticValueSlot<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), propertyName, slot);
}
-bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+bool RegExpConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
return getStaticValueDescriptor<RegExpConstructor, InternalFunction>(exec, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(object), propertyName, descriptor);
}
-JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar1(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 1);
}
-JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar2(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 2);
}
-JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar3(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 3);
}
-JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar4(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 4);
}
-JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar5(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 5);
}
-JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar6(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 6);
}
-JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar7(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 7);
}
-JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar8(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 8);
}
-JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorDollar9(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 9);
}
-JSValue regExpConstructorInput(ExecState*, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorInput(ExecState*, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->input();
}
-JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorMultiline(ExecState*, JSValue slotBase, PropertyName)
{
return jsBoolean(asRegExpConstructor(slotBase)->multiline());
}
-JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorLastMatch(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getBackref(exec, 0);
}
-JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorLastParen(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getLastParen(exec);
}
-JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorLeftContext(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getLeftContext(exec);
}
-JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, const Identifier&)
+JSValue regExpConstructorRightContext(ExecState* exec, JSValue slotBase, PropertyName)
{
return asRegExpConstructor(slotBase)->getRightContext(exec);
}
-void RegExpConstructor::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+void RegExpConstructor::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
lookupPut<RegExpConstructor, InternalFunction>(exec, propertyName, value, ExecState::regExpConstructorTable(exec), jsCast<RegExpConstructor*>(cell), slot);
}
if (arg0.inherits(&RegExpObject::s_info)) {
if (!arg1.isUndefined())
- return throwError(exec, createTypeError(exec, "Cannot supply flags when constructing one RegExp from another."));
+ return throwError(exec, createTypeError(exec, ASCIILiteral("Cannot supply flags when constructing one RegExp from another.")));
// If called as a function, this just returns the first argument (see 15.10.3.1).
if (callAsConstructor) {
RegExp* regExp = static_cast<RegExpObject*>(asObject(arg0))->regExp();
return asObject(arg0);
}
- UString pattern = arg0.isUndefined() ? UString("") : arg0.toString(exec)->value(exec);
+ String pattern = arg0.isUndefined() ? String("") : arg0.toString(exec)->value(exec);
if (exec->hadException())
return 0;
if (exec->hadException())
return 0;
if (flags == InvalidFlags)
- return throwError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
+ return throwError(exec, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor.")));
}
- RegExp* regExp = RegExp::create(exec->globalData(), pattern, flags);
+ RegExp* regExp = RegExp::create(exec->vm(), pattern, flags);
if (!regExp->isValid())
return throwError(exec, createSyntaxError(exec, regExp->errorMessage()));
return RegExpObject::create(exec, exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp);