From 56f02f49f3d48ece0d96ab1482d6b0d0b22839e2 Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Tue, 6 Aug 2002 17:34:32 +0000 Subject: [PATCH] Adding more static defn. --- js2/src/js2metadata.cpp | 31 +++++++++++++++++++++++++++++++ js2/src/js2metadata.h | 14 ++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/js2/src/js2metadata.cpp b/js2/src/js2metadata.cpp index 1cc91f8e163a..54529cef9d41 100644 --- a/js2/src/js2metadata.cpp +++ b/js2/src/js2metadata.cpp @@ -119,6 +119,17 @@ namespace MetaData { defineHoistedVar(env, *v->name, p); } else { + CompoundAttribute *a = Attribute::toCompoundAttribute(attr); + if (a->dynamic || a->prototype) + reportError(Exception::definitionError, "Illegal attribute", p->pos); + MemberModifier memberMod = a->memberMod; + if ((env->getTopFrame()->kind == Frame::Class) + && (memberMod == Attribute::NoModifier)) + memberMod == Attribute::Final; + switch (memberMod) { + case Attribute::NoModifier: + case Attribute::Static: + } } v = v->next; @@ -402,6 +413,26 @@ namespace MetaData { { } + CompoundAttribute *Attribute::toCompoundAttribute(Attribute *a) + { + if (a) + return a->toCompoundAttribute(); + else + return new CompoundAttribute(); + } + + CompoundAttribute *Namespace::toCompoundAttribute() + { + CompoundAttribute *t = new CompoundAttribute(); + t->addNamespace(this); + return t; + } + + CompoundAttribute *TrueAttribute::toCompoundAttribute() + { + return new CompoundAttribute(); + } + /************************************************************************************ diff --git a/js2/src/js2metadata.h b/js2/src/js2metadata.h index 982b87f06403..9ac25678d8b1 100644 --- a/js2/src/js2metadata.h +++ b/js2/src/js2metadata.h @@ -53,7 +53,8 @@ class JS2Metadata; class JS2Class; class StaticBinding; class Environment; -class Context; +class Context; +class CompoundAttribute; typedef jsval js2val; typedef void (Invokable)(); @@ -82,10 +83,10 @@ public: Attribute(AttributeKind kind) : kind(kind) { } static Attribute *combineAttributes(Attribute *a, Attribute *b); + static CompoundAttribute *toCompoundAttribute(Attribute *a); + + virtual CompoundAttribute *toCompoundAttribute() { ASSERT(false); return NULL; } -#ifdef DEBUG - virtual void uselessVirtual() { } // want the checked_cast stuff to work, so need a virtual function -#endif }; // A Namespace (is also an attribute) @@ -93,6 +94,8 @@ class Namespace : public Attribute { public: Namespace(StringAtom &name) : Attribute(NamespaceKind), name(name) { } + virtual CompoundAttribute *toCompoundAttribute(); + StringAtom &name; // The namespace's name used by toString }; @@ -482,6 +485,7 @@ public: class TrueAttribute : public Attribute { public: TrueAttribute() : Attribute(TrueKind) { } + virtual CompoundAttribute *toCompoundAttribute(); }; // The 'false' attribute @@ -497,6 +501,8 @@ public: CompoundAttribute(); void addNamespace(Namespace *n); + virtual CompoundAttribute *toCompoundAttribute() { return this; } + NamespaceList *namespaces; // The set of namespaces contained in this attribute bool xplicit; // true if the explicit attribute has been given bool dynamic; // true if the dynamic attribute has been given