More boolean class fun.

git-svn-id: svn://10.0.0.236/trunk@135871 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
2003-01-06 05:58:07 +00:00
parent f8b543dc9a
commit 6d5c46a339
2 changed files with 13 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ namespace MetaData {
static js2val Boolean_Constructor(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc)
{
js2val thatValue = OBJECT_TO_JS2VAL(new BooleanInstance(meta->booleanClass));
js2val thatValue = OBJECT_TO_JS2VAL(new BooleanInstance(meta->booleanClass->prototype, meta->booleanClass));
BooleanInstance *boolInst = checked_cast<BooleanInstance *>(JS2VAL_TO_OBJECT(thatValue));
if (argc > 0)
@@ -113,16 +113,23 @@ namespace MetaData {
NamespaceList publicNamespaceList;
publicNamespaceList.push_back(meta->publicNamespace);
meta->booleanClass->prototype = new PrototypeInstance(meta->objectClass->prototype, meta->booleanClass);
meta->booleanClass->prototype = new BooleanInstance(meta->objectClass->prototype, meta->booleanClass);
// Adding "prototype" as a static member of the class - not a dynamic property
meta->env->addFrame(meta->booleanClass);
Variable *v = new Variable(meta->booleanClass, OBJECT_TO_JS2VAL(meta->booleanClass->prototype), true);
meta->defineStaticMember(meta->env, meta->engine->prototype_StringAtom, &publicNamespaceList, Attribute::NoOverride, false, ReadWriteAccess, v, 0);
meta->env->removeTopFrame();
// Add "constructor" as a dynamic property of the prototype
CallableInstance *fInst = new CallableInstance(meta->functionClass);
fInst->fWrap = new FunctionWrapper(true, new ParameterFrame(JS2VAL_INACCESSIBLE, true), Boolean_Constructor);
meta->writeDynamicProperty(meta->booleanClass->prototype, new Multiname(&meta->world.identifiers["constructor"], meta->publicNamespace), true, OBJECT_TO_JS2VAL(fInst), RunPhase);
PrototypeFunction *pf = &prototypeFunctions[0];
while (pf->name) {
CallableInstance *fInst = new CallableInstance(meta->functionClass);
fInst = new CallableInstance(meta->functionClass);
fInst->fWrap = new FunctionWrapper(true, new ParameterFrame(JS2VAL_INACCESSIBLE, true), pf->code);
/*
XXX not prototype object function properties, like ECMA3