From 9ce999f9903aec3d8ea16abbcfe7cb6ca5d9b38e Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Mon, 26 Jun 2000 17:42:20 +0000 Subject: [PATCH] added JSObject::deleteProperty(), and changed mName in JSType to be a JSString. Need to revisit other uses of String soon. git-svn-id: svn://10.0.0.236/trunk@73230 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/js2/jstypes.h | 16 ++++++++++++++-- mozilla/js2/src/jstypes.h | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mozilla/js/js2/jstypes.h b/mozilla/js/js2/jstypes.h index 56b960416bb..dceb610a8aa 100644 --- a/mozilla/js/js2/jstypes.h +++ b/mozilla/js/js2/jstypes.h @@ -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; }; diff --git a/mozilla/js2/src/jstypes.h b/mozilla/js2/src/jstypes.h index 56b960416bb..dceb610a8aa 100644 --- a/mozilla/js2/src/jstypes.h +++ b/mozilla/js2/src/jstypes.h @@ -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; };