added JSObject::deleteProperty(), and changed mName in JSType to be a JSString. Need to revisit other uses of String soon.

This commit is contained in:
beard%netscape.com 2000-06-26 17:42:20 +00:00
parent 07dff8c5d1
commit f276cc3dfd
2 changed files with 28 additions and 4 deletions

View File

@ -242,6 +242,18 @@ namespace JSTypes {
{
return (mProperties[name] = value);
}
const JSValue& deleteProperty(const String& name)
{
JSProperties::iterator i = mProperties.find(name);
if (i != mProperties.end()) {
mProperties.erase(i);
return kTrue;
}
if (mPrototype)
return mPrototype->deleteProperty(name);
return kFalse;
}
void setPrototype(JSObject* prototype)
{
@ -445,14 +457,14 @@ namespace JSTypes {
class JSType : public JSObject {
protected:
String mName;
JSString mName;
const JSType *mBaseType;
public:
JSType(const String &name, const JSType *baseType) : mName(name), mBaseType(baseType) { }
enum { NoRelation = 0x7FFFFFFF };
const String& getName() const { return mName; }
const JSString& getName() const { return mName; }
int32 distance(const JSType *other) const;
};

View File

@ -242,6 +242,18 @@ namespace JSTypes {
{
return (mProperties[name] = value);
}
const JSValue& deleteProperty(const String& name)
{
JSProperties::iterator i = mProperties.find(name);
if (i != mProperties.end()) {
mProperties.erase(i);
return kTrue;
}
if (mPrototype)
return mPrototype->deleteProperty(name);
return kFalse;
}
void setPrototype(JSObject* prototype)
{
@ -445,14 +457,14 @@ namespace JSTypes {
class JSType : public JSObject {
protected:
String mName;
JSString mName;
const JSType *mBaseType;
public:
JSType(const String &name, const JSType *baseType) : mName(name), mBaseType(baseType) { }
enum { NoRelation = 0x7FFFFFFF };
const String& getName() const { return mName; }
const JSString& getName() const { return mName; }
int32 distance(const JSType *other) const;
};