Home | History | Annotate | Line # | Download | only in dmd
      1      1.1  mrg 
      2      1.1  mrg /* Compiler implementation of the D programming language
      3  1.1.1.3  mrg  * Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
      4      1.1  mrg  * written by Walter Bright
      5  1.1.1.3  mrg  * https://www.digitalmars.com
      6      1.1  mrg  * Distributed under the Boost Software License, Version 1.0.
      7  1.1.1.3  mrg  * https://www.boost.org/LICENSE_1_0.txt
      8      1.1  mrg  * https://github.com/dlang/dmd/blob/master/src/dmd/dsymbol.h
      9      1.1  mrg  */
     10      1.1  mrg 
     11      1.1  mrg #pragma once
     12      1.1  mrg 
     13  1.1.1.3  mrg #include "root/port.h"
     14  1.1.1.3  mrg #include "ast_node.h"
     15      1.1  mrg #include "globals.h"
     16      1.1  mrg #include "arraytypes.h"
     17      1.1  mrg #include "visitor.h"
     18      1.1  mrg 
     19  1.1.1.3  mrg class CPPNamespaceDeclaration;
     20      1.1  mrg class Identifier;
     21      1.1  mrg struct Scope;
     22      1.1  mrg class DsymbolTable;
     23      1.1  mrg class Declaration;
     24      1.1  mrg class ThisDeclaration;
     25  1.1.1.3  mrg class BitFieldDeclaration;
     26      1.1  mrg class TypeInfoDeclaration;
     27      1.1  mrg class TupleDeclaration;
     28      1.1  mrg class AliasDeclaration;
     29      1.1  mrg class AggregateDeclaration;
     30      1.1  mrg class EnumDeclaration;
     31      1.1  mrg class ClassDeclaration;
     32      1.1  mrg class InterfaceDeclaration;
     33      1.1  mrg class StructDeclaration;
     34      1.1  mrg class UnionDeclaration;
     35      1.1  mrg class FuncDeclaration;
     36      1.1  mrg class FuncAliasDeclaration;
     37      1.1  mrg class OverDeclaration;
     38      1.1  mrg class FuncLiteralDeclaration;
     39      1.1  mrg class CtorDeclaration;
     40      1.1  mrg class PostBlitDeclaration;
     41      1.1  mrg class DtorDeclaration;
     42      1.1  mrg class StaticCtorDeclaration;
     43      1.1  mrg class StaticDtorDeclaration;
     44      1.1  mrg class SharedStaticCtorDeclaration;
     45      1.1  mrg class SharedStaticDtorDeclaration;
     46      1.1  mrg class InvariantDeclaration;
     47      1.1  mrg class UnitTestDeclaration;
     48      1.1  mrg class NewDeclaration;
     49      1.1  mrg class VarDeclaration;
     50      1.1  mrg class AttribDeclaration;
     51  1.1.1.3  mrg class VisibilityDeclaration;
     52      1.1  mrg class Package;
     53      1.1  mrg class Module;
     54      1.1  mrg class Import;
     55      1.1  mrg class Type;
     56      1.1  mrg class TypeTuple;
     57      1.1  mrg class WithStatement;
     58      1.1  mrg class LabelDsymbol;
     59      1.1  mrg class ScopeDsymbol;
     60      1.1  mrg class ForwardingScopeDsymbol;
     61      1.1  mrg class TemplateDeclaration;
     62      1.1  mrg class TemplateInstance;
     63      1.1  mrg class TemplateMixin;
     64      1.1  mrg class ForwardingAttribDeclaration;
     65      1.1  mrg class Nspace;
     66      1.1  mrg class EnumMember;
     67      1.1  mrg class WithScopeSymbol;
     68      1.1  mrg class ArrayScopeSymbol;
     69      1.1  mrg class SymbolDeclaration;
     70      1.1  mrg class Expression;
     71  1.1.1.3  mrg class ExpressionDsymbol;
     72  1.1.1.3  mrg class AliasAssign;
     73      1.1  mrg class OverloadSet;
     74  1.1.1.3  mrg class StaticAssert;
     75      1.1  mrg struct AA;
     76      1.1  mrg #ifdef IN_GCC
     77      1.1  mrg typedef union tree_node Symbol;
     78      1.1  mrg #else
     79      1.1  mrg struct Symbol;
     80      1.1  mrg #endif
     81      1.1  mrg 
     82      1.1  mrg struct Ungag
     83      1.1  mrg {
     84      1.1  mrg     unsigned oldgag;
     85      1.1  mrg 
     86      1.1  mrg     Ungag(unsigned old) : oldgag(old) {}
     87      1.1  mrg     ~Ungag() { global.gag = oldgag; }
     88      1.1  mrg };
     89      1.1  mrg 
     90  1.1.1.3  mrg void dsymbolSemantic(Dsymbol *dsym, Scope *sc);
     91  1.1.1.3  mrg void semantic2(Dsymbol *dsym, Scope *sc);
     92  1.1.1.3  mrg void semantic3(Dsymbol *dsym, Scope* sc);
     93  1.1.1.3  mrg 
     94  1.1.1.3  mrg struct Visibility
     95  1.1.1.3  mrg {
     96  1.1.1.3  mrg     enum Kind
     97  1.1.1.3  mrg     {
     98  1.1.1.3  mrg         undefined,
     99  1.1.1.3  mrg         none,           // no access
    100  1.1.1.3  mrg         private_,
    101  1.1.1.3  mrg         package_,
    102  1.1.1.3  mrg         protected_,
    103  1.1.1.3  mrg         public_,
    104  1.1.1.3  mrg         export_
    105  1.1.1.3  mrg     };
    106  1.1.1.3  mrg     Kind kind;
    107      1.1  mrg     Package *pkg;
    108      1.1  mrg };
    109      1.1  mrg 
    110      1.1  mrg /* State of symbol in winding its way through the passes of the compiler
    111      1.1  mrg  */
    112  1.1.1.3  mrg enum class PASS : uint8_t
    113  1.1.1.3  mrg {
    114  1.1.1.3  mrg     initial,        // initial state
    115  1.1.1.3  mrg     semantic,       // semantic() started
    116  1.1.1.3  mrg     semanticdone,   // semantic() done
    117  1.1.1.3  mrg     semantic2,      // semantic2() started
    118  1.1.1.3  mrg     semantic2done,  // semantic2() done
    119  1.1.1.3  mrg     semantic3,      // semantic3() started
    120  1.1.1.3  mrg     semantic3done,  // semantic3() done
    121  1.1.1.3  mrg     inline_,         // inline started
    122  1.1.1.3  mrg     inlinedone,     // inline done
    123  1.1.1.3  mrg     obj             // toObjFile() run
    124  1.1.1.3  mrg };
    125  1.1.1.3  mrg 
    126  1.1.1.3  mrg enum
    127      1.1  mrg {
    128      1.1  mrg     PASSinit,           // initial state
    129      1.1  mrg     PASSsemantic,       // semantic() started
    130      1.1  mrg     PASSsemanticdone,   // semantic() done
    131      1.1  mrg     PASSsemantic2,      // semantic2() started
    132      1.1  mrg     PASSsemantic2done,  // semantic2() done
    133      1.1  mrg     PASSsemantic3,      // semantic3() started
    134      1.1  mrg     PASSsemantic3done,  // semantic3() done
    135      1.1  mrg     PASSinline,         // inline started
    136      1.1  mrg     PASSinlinedone,     // inline done
    137      1.1  mrg     PASSobj             // toObjFile() run
    138      1.1  mrg };
    139      1.1  mrg 
    140      1.1  mrg /* Flags for symbol search
    141      1.1  mrg  */
    142      1.1  mrg enum
    143      1.1  mrg {
    144      1.1  mrg     IgnoreNone              = 0x00, // default
    145      1.1  mrg     IgnorePrivateImports    = 0x01, // don't search private imports
    146      1.1  mrg     IgnoreErrors            = 0x02, // don't give error messages
    147      1.1  mrg     IgnoreAmbiguous         = 0x04, // return NULL if ambiguous
    148      1.1  mrg     SearchLocalsOnly        = 0x08, // only look at locals (don't search imports)
    149      1.1  mrg     SearchImportsOnly       = 0x10, // only look in imports
    150      1.1  mrg     SearchUnqualifiedModule = 0x20, // the module scope search is unqualified,
    151      1.1  mrg                                     // meaning don't search imports in that scope,
    152      1.1  mrg                                     // because qualified module searches search
    153      1.1  mrg                                     // their imports
    154  1.1.1.3  mrg     IgnoreSymbolVisibility  = 0x80,  // also find private and package protected symbols
    155  1.1.1.3  mrg     TagNameSpace            = 0x100, // search ImportC tag symbol table
    156      1.1  mrg };
    157      1.1  mrg 
    158  1.1.1.3  mrg struct FieldState
    159  1.1.1.3  mrg {
    160  1.1.1.3  mrg     unsigned offset;
    161  1.1.1.3  mrg 
    162  1.1.1.3  mrg     unsigned fieldOffset;
    163  1.1.1.3  mrg     unsigned fieldSize;
    164  1.1.1.3  mrg     unsigned fieldAlign;
    165  1.1.1.3  mrg     unsigned bitOffset;
    166  1.1.1.3  mrg 
    167  1.1.1.3  mrg     bool inFlight;
    168  1.1.1.3  mrg };
    169      1.1  mrg 
    170  1.1.1.3  mrg class Dsymbol : public ASTNode
    171      1.1  mrg {
    172      1.1  mrg public:
    173      1.1  mrg     Identifier *ident;
    174      1.1  mrg     Dsymbol *parent;
    175  1.1.1.3  mrg     /// C++ namespace this symbol belongs to
    176  1.1.1.3  mrg     CPPNamespaceDeclaration *namespace_;
    177      1.1  mrg     Symbol *csym;               // symbol for code generator
    178      1.1  mrg     Loc loc;                    // where defined
    179      1.1  mrg     Scope *_scope;               // !=NULL means context to use for semantic()
    180      1.1  mrg     const utf8_t *prettystring;
    181      1.1  mrg     bool errors;                // this symbol failed to pass semantic()
    182      1.1  mrg     PASS semanticRun;
    183  1.1.1.3  mrg     unsigned short localNum;        // perturb mangled name to avoid collisions with those in FuncDeclaration.localsymtab
    184      1.1  mrg     DeprecatedDeclaration *depdecl; // customized deprecation message
    185      1.1  mrg     UserAttributeDeclaration *userAttribDecl;   // user defined attributes
    186      1.1  mrg 
    187      1.1  mrg     static Dsymbol *create(Identifier *);
    188  1.1.1.3  mrg     const char *toChars() const;
    189      1.1  mrg     virtual const char *toPrettyCharsHelper(); // helper to print fully qualified (template) arguments
    190  1.1.1.3  mrg     Loc getLoc();
    191      1.1  mrg     const char *locToChars();
    192  1.1.1.3  mrg     bool equals(const RootObject *o) const;
    193  1.1.1.3  mrg     bool isAnonymous() const;
    194  1.1.1.3  mrg     void error(const Loc &loc, const char *format, ...);
    195      1.1  mrg     void error(const char *format, ...);
    196  1.1.1.3  mrg     void deprecation(const Loc &loc, const char *format, ...);
    197      1.1  mrg     void deprecation(const char *format, ...);
    198  1.1.1.3  mrg     bool checkDeprecated(const Loc &loc, Scope *sc);
    199      1.1  mrg     Module *getModule();
    200  1.1.1.3  mrg     bool isCsymbol();
    201      1.1  mrg     Module *getAccessModule();
    202      1.1  mrg     Dsymbol *pastMixin();
    203      1.1  mrg     Dsymbol *toParent();
    204      1.1  mrg     Dsymbol *toParent2();
    205  1.1.1.3  mrg     Dsymbol *toParentDecl();
    206  1.1.1.3  mrg     Dsymbol *toParentLocal();
    207  1.1.1.3  mrg     Dsymbol *toParentP(Dsymbol *p1, Dsymbol *p2 = NULL);
    208      1.1  mrg     TemplateInstance *isInstantiated();
    209  1.1.1.3  mrg     bool followInstantiationContext(Dsymbol *p1, Dsymbol *p2 = NULL);
    210      1.1  mrg     TemplateInstance *isSpeculative();
    211      1.1  mrg     Ungag ungagSpeculative();
    212      1.1  mrg 
    213      1.1  mrg     // kludge for template.isSymbol()
    214  1.1.1.3  mrg     DYNCAST dyncast() const { return DYNCAST_DSYMBOL; }
    215      1.1  mrg 
    216      1.1  mrg     virtual Identifier *getIdent();
    217      1.1  mrg     virtual const char *toPrettyChars(bool QualifyTypes = false);
    218      1.1  mrg     virtual const char *kind() const;
    219      1.1  mrg     virtual Dsymbol *toAlias();                 // resolve real symbol
    220      1.1  mrg     virtual Dsymbol *toAlias2();
    221      1.1  mrg     virtual void addMember(Scope *sc, ScopeDsymbol *sds);
    222      1.1  mrg     virtual void setScope(Scope *sc);
    223      1.1  mrg     virtual void importAll(Scope *sc);
    224      1.1  mrg     virtual Dsymbol *search(const Loc &loc, Identifier *ident, int flags = IgnoreNone);
    225      1.1  mrg     virtual bool overloadInsert(Dsymbol *s);
    226  1.1.1.3  mrg     virtual uinteger_t size(const Loc &loc);
    227      1.1  mrg     virtual bool isforwardRef();
    228      1.1  mrg     virtual AggregateDeclaration *isThis();     // is a 'this' required to access the member
    229      1.1  mrg     virtual bool isExport() const;              // is Dsymbol exported?
    230      1.1  mrg     virtual bool isImportedSymbol() const;      // is Dsymbol imported?
    231  1.1.1.3  mrg     virtual bool isDeprecated() const;                // is Dsymbol deprecated?
    232  1.1.1.3  mrg     virtual bool isOverloadable() const;
    233      1.1  mrg     virtual LabelDsymbol *isLabel();            // is this a LabelDsymbol?
    234  1.1.1.3  mrg     AggregateDeclaration *isMember();           // is toParent() an AggregateDeclaration?
    235  1.1.1.3  mrg     AggregateDeclaration *isMember2();          // is toParent2() an AggregateDeclaration?
    236  1.1.1.3  mrg     AggregateDeclaration *isMemberDecl();       // is toParentDecl() an AggregateDeclaration?
    237  1.1.1.3  mrg     AggregateDeclaration *isMemberLocal();      // is toParentLocal() an AggregateDeclaration?
    238  1.1.1.3  mrg     ClassDeclaration *isClassMember();          // isMember() is a ClassDeclaration?
    239      1.1  mrg     virtual Type *getType();                    // is this a type?
    240      1.1  mrg     virtual bool needThis();                    // need a 'this' pointer?
    241  1.1.1.3  mrg     virtual Visibility visible();
    242      1.1  mrg     virtual Dsymbol *syntaxCopy(Dsymbol *s);    // copy only syntax trees
    243      1.1  mrg     virtual bool oneMember(Dsymbol **ps, Identifier *ident);
    244  1.1.1.3  mrg     virtual void setFieldOffset(AggregateDeclaration *ad, FieldState& fieldState, bool isunion);
    245      1.1  mrg     virtual bool hasPointers();
    246      1.1  mrg     virtual bool hasStaticCtorOrDtor();
    247      1.1  mrg     virtual void addLocalClass(ClassDeclarations *) { }
    248  1.1.1.3  mrg     virtual void addObjcSymbols(ClassDeclarations *, ClassDeclarations *) { }
    249      1.1  mrg     virtual void checkCtorConstInit() { }
    250      1.1  mrg 
    251      1.1  mrg     virtual void addComment(const utf8_t *comment);
    252  1.1.1.3  mrg     const utf8_t *comment();                      // current value of comment
    253  1.1.1.3  mrg 
    254  1.1.1.3  mrg     UnitTestDeclaration *ddocUnittest();
    255  1.1.1.3  mrg     void ddocUnittest(UnitTestDeclaration *);
    256      1.1  mrg 
    257      1.1  mrg     bool inNonRoot();
    258      1.1  mrg 
    259      1.1  mrg     // Eliminate need for dynamic_cast
    260      1.1  mrg     virtual Package *isPackage() { return NULL; }
    261      1.1  mrg     virtual Module *isModule() { return NULL; }
    262      1.1  mrg     virtual EnumMember *isEnumMember() { return NULL; }
    263      1.1  mrg     virtual TemplateDeclaration *isTemplateDeclaration() { return NULL; }
    264      1.1  mrg     virtual TemplateInstance *isTemplateInstance() { return NULL; }
    265      1.1  mrg     virtual TemplateMixin *isTemplateMixin() { return NULL; }
    266      1.1  mrg     virtual ForwardingAttribDeclaration *isForwardingAttribDeclaration() { return NULL; }
    267      1.1  mrg     virtual Nspace *isNspace() { return NULL; }
    268      1.1  mrg     virtual Declaration *isDeclaration() { return NULL; }
    269      1.1  mrg     virtual StorageClassDeclaration *isStorageClassDeclaration(){ return NULL; }
    270  1.1.1.3  mrg     virtual ExpressionDsymbol *isExpressionDsymbol() { return NULL; }
    271  1.1.1.3  mrg     virtual AliasAssign *isAliasAssign() { return NULL; }
    272      1.1  mrg     virtual ThisDeclaration *isThisDeclaration() { return NULL; }
    273  1.1.1.3  mrg     virtual BitFieldDeclaration *isBitFieldDeclaration() { return NULL; }
    274      1.1  mrg     virtual TypeInfoDeclaration *isTypeInfoDeclaration() { return NULL; }
    275      1.1  mrg     virtual TupleDeclaration *isTupleDeclaration() { return NULL; }
    276      1.1  mrg     virtual AliasDeclaration *isAliasDeclaration() { return NULL; }
    277      1.1  mrg     virtual AggregateDeclaration *isAggregateDeclaration() { return NULL; }
    278      1.1  mrg     virtual FuncDeclaration *isFuncDeclaration() { return NULL; }
    279      1.1  mrg     virtual FuncAliasDeclaration *isFuncAliasDeclaration() { return NULL; }
    280      1.1  mrg     virtual OverDeclaration *isOverDeclaration() { return NULL; }
    281      1.1  mrg     virtual FuncLiteralDeclaration *isFuncLiteralDeclaration() { return NULL; }
    282      1.1  mrg     virtual CtorDeclaration *isCtorDeclaration() { return NULL; }
    283      1.1  mrg     virtual PostBlitDeclaration *isPostBlitDeclaration() { return NULL; }
    284      1.1  mrg     virtual DtorDeclaration *isDtorDeclaration() { return NULL; }
    285      1.1  mrg     virtual StaticCtorDeclaration *isStaticCtorDeclaration() { return NULL; }
    286      1.1  mrg     virtual StaticDtorDeclaration *isStaticDtorDeclaration() { return NULL; }
    287      1.1  mrg     virtual SharedStaticCtorDeclaration *isSharedStaticCtorDeclaration() { return NULL; }
    288      1.1  mrg     virtual SharedStaticDtorDeclaration *isSharedStaticDtorDeclaration() { return NULL; }
    289      1.1  mrg     virtual InvariantDeclaration *isInvariantDeclaration() { return NULL; }
    290      1.1  mrg     virtual UnitTestDeclaration *isUnitTestDeclaration() { return NULL; }
    291      1.1  mrg     virtual NewDeclaration *isNewDeclaration() { return NULL; }
    292      1.1  mrg     virtual VarDeclaration *isVarDeclaration() { return NULL; }
    293  1.1.1.3  mrg     virtual VersionSymbol *isVersionSymbol() { return NULL; }
    294  1.1.1.3  mrg     virtual DebugSymbol *isDebugSymbol() { return NULL; }
    295      1.1  mrg     virtual ClassDeclaration *isClassDeclaration() { return NULL; }
    296      1.1  mrg     virtual StructDeclaration *isStructDeclaration() { return NULL; }
    297      1.1  mrg     virtual UnionDeclaration *isUnionDeclaration() { return NULL; }
    298      1.1  mrg     virtual InterfaceDeclaration *isInterfaceDeclaration() { return NULL; }
    299      1.1  mrg     virtual ScopeDsymbol *isScopeDsymbol() { return NULL; }
    300      1.1  mrg     virtual ForwardingScopeDsymbol *isForwardingScopeDsymbol() { return NULL; }
    301      1.1  mrg     virtual WithScopeSymbol *isWithScopeSymbol() { return NULL; }
    302      1.1  mrg     virtual ArrayScopeSymbol *isArrayScopeSymbol() { return NULL; }
    303      1.1  mrg     virtual Import *isImport() { return NULL; }
    304      1.1  mrg     virtual EnumDeclaration *isEnumDeclaration() { return NULL; }
    305      1.1  mrg     virtual SymbolDeclaration *isSymbolDeclaration() { return NULL; }
    306      1.1  mrg     virtual AttribDeclaration *isAttribDeclaration() { return NULL; }
    307      1.1  mrg     virtual AnonDeclaration *isAnonDeclaration() { return NULL; }
    308  1.1.1.3  mrg     virtual CPPNamespaceDeclaration *isCPPNamespaceDeclaration() { return NULL; }
    309  1.1.1.3  mrg     virtual VisibilityDeclaration *isVisibilityDeclaration() { return NULL; }
    310      1.1  mrg     virtual OverloadSet *isOverloadSet() { return NULL; }
    311  1.1.1.3  mrg     virtual CompileDeclaration *isCompileDeclaration() { return NULL; }
    312  1.1.1.3  mrg     virtual StaticAssert *isStaticAssert() { return NULL; }
    313  1.1.1.3  mrg     void accept(Visitor *v) { v->visit(this); }
    314      1.1  mrg };
    315      1.1  mrg 
    316      1.1  mrg // Dsymbol that generates a scope
    317      1.1  mrg 
    318      1.1  mrg class ScopeDsymbol : public Dsymbol
    319      1.1  mrg {
    320      1.1  mrg public:
    321      1.1  mrg     Dsymbols *members;          // all Dsymbol's in this scope
    322      1.1  mrg     DsymbolTable *symtab;       // members[] sorted into table
    323      1.1  mrg     unsigned endlinnum;         // the linnumber of the statement after the scope (0 if unknown)
    324      1.1  mrg 
    325      1.1  mrg private:
    326      1.1  mrg     Dsymbols *importedScopes;   // imported Dsymbol's
    327  1.1.1.3  mrg     Visibility::Kind *visibilities;   // array of `Visibility.Kind`, one for each import
    328      1.1  mrg 
    329      1.1  mrg     BitArray accessiblePackages, privateAccessiblePackages;
    330      1.1  mrg 
    331      1.1  mrg public:
    332  1.1.1.3  mrg     ScopeDsymbol *syntaxCopy(Dsymbol *s);
    333      1.1  mrg     Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
    334  1.1.1.3  mrg     virtual void importScope(Dsymbol *s, Visibility visibility);
    335  1.1.1.3  mrg     virtual bool isPackageAccessible(Package *p, Visibility visibility, int flags = 0);
    336      1.1  mrg     bool isforwardRef();
    337  1.1.1.3  mrg     static void multiplyDefined(const Loc &loc, Dsymbol *s1, Dsymbol *s2);
    338      1.1  mrg     const char *kind() const;
    339      1.1  mrg     FuncDeclaration *findGetMembers();
    340      1.1  mrg     virtual Dsymbol *symtabInsert(Dsymbol *s);
    341      1.1  mrg     virtual Dsymbol *symtabLookup(Dsymbol *s, Identifier *id);
    342      1.1  mrg     bool hasStaticCtorOrDtor();
    343      1.1  mrg 
    344      1.1  mrg     ScopeDsymbol *isScopeDsymbol() { return this; }
    345      1.1  mrg     void accept(Visitor *v) { v->visit(this); }
    346      1.1  mrg };
    347      1.1  mrg 
    348      1.1  mrg // With statement scope
    349      1.1  mrg 
    350      1.1  mrg class WithScopeSymbol : public ScopeDsymbol
    351      1.1  mrg {
    352      1.1  mrg public:
    353      1.1  mrg     WithStatement *withstate;
    354      1.1  mrg 
    355      1.1  mrg     Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
    356      1.1  mrg 
    357      1.1  mrg     WithScopeSymbol *isWithScopeSymbol() { return this; }
    358      1.1  mrg     void accept(Visitor *v) { v->visit(this); }
    359      1.1  mrg };
    360      1.1  mrg 
    361      1.1  mrg // Array Index/Slice scope
    362      1.1  mrg 
    363      1.1  mrg class ArrayScopeSymbol : public ScopeDsymbol
    364      1.1  mrg {
    365  1.1.1.3  mrg private:
    366  1.1.1.3  mrg     RootObject *arrayContent;
    367      1.1  mrg public:
    368      1.1  mrg     Scope *sc;
    369      1.1  mrg 
    370      1.1  mrg     Dsymbol *search(const Loc &loc, Identifier *ident, int flags = IgnoreNone);
    371      1.1  mrg 
    372      1.1  mrg     ArrayScopeSymbol *isArrayScopeSymbol() { return this; }
    373      1.1  mrg     void accept(Visitor *v) { v->visit(this); }
    374      1.1  mrg };
    375      1.1  mrg 
    376      1.1  mrg // Overload Sets
    377      1.1  mrg 
    378      1.1  mrg class OverloadSet : public Dsymbol
    379      1.1  mrg {
    380      1.1  mrg public:
    381      1.1  mrg     Dsymbols a;         // array of Dsymbols
    382      1.1  mrg 
    383      1.1  mrg     void push(Dsymbol *s);
    384      1.1  mrg     OverloadSet *isOverloadSet() { return this; }
    385      1.1  mrg     const char *kind() const;
    386      1.1  mrg     void accept(Visitor *v) { v->visit(this); }
    387      1.1  mrg };
    388      1.1  mrg 
    389      1.1  mrg // Forwarding ScopeDsymbol
    390      1.1  mrg 
    391      1.1  mrg class ForwardingScopeDsymbol : public ScopeDsymbol
    392      1.1  mrg {
    393  1.1.1.2  mrg public:
    394      1.1  mrg     ScopeDsymbol *forward;
    395      1.1  mrg 
    396      1.1  mrg     Dsymbol *symtabInsert(Dsymbol *s);
    397      1.1  mrg     Dsymbol *symtabLookup(Dsymbol *s, Identifier *id);
    398  1.1.1.3  mrg     void importScope(Dsymbol *s, Visibility visibility);
    399      1.1  mrg     const char *kind() const;
    400      1.1  mrg 
    401      1.1  mrg     ForwardingScopeDsymbol *isForwardingScopeDsymbol() { return this; }
    402      1.1  mrg };
    403      1.1  mrg 
    404  1.1.1.3  mrg class ExpressionDsymbol : public Dsymbol
    405  1.1.1.3  mrg {
    406  1.1.1.3  mrg public:
    407  1.1.1.3  mrg     Expression *exp;
    408  1.1.1.3  mrg 
    409  1.1.1.3  mrg     ExpressionDsymbol *isExpressionDsymbol() { return this; }
    410  1.1.1.3  mrg };
    411  1.1.1.3  mrg 
    412      1.1  mrg // Table of Dsymbol's
    413      1.1  mrg 
    414      1.1  mrg class DsymbolTable : public RootObject
    415      1.1  mrg {
    416      1.1  mrg public:
    417      1.1  mrg     AA *tab;
    418      1.1  mrg 
    419      1.1  mrg     // Look up Identifier. Return Dsymbol if found, NULL if not.
    420      1.1  mrg     Dsymbol *lookup(Identifier const * const ident);
    421      1.1  mrg 
    422  1.1.1.3  mrg     // Look for Dsymbol in table. If there, return it. If not, insert s and return that.
    423  1.1.1.3  mrg     void update(Dsymbol *s);
    424  1.1.1.3  mrg 
    425      1.1  mrg     // Insert Dsymbol in table. Return NULL if already there.
    426      1.1  mrg     Dsymbol *insert(Dsymbol *s);
    427      1.1  mrg     Dsymbol *insert(Identifier const * const ident, Dsymbol *s);     // when ident and s are not the same
    428  1.1.1.3  mrg 
    429  1.1.1.3  mrg     // Number of symbols in symbol table
    430  1.1.1.3  mrg     size_t length() const;
    431      1.1  mrg };
    432