Home | History | Annotate | Line # | Download | only in dmd
      1 
      2 /* Compiler implementation of the D programming language
      3  * Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
      4  * written by Walter Bright
      5  * https://www.digitalmars.com
      6  * Distributed under the Boost Software License, Version 1.0.
      7  * https://www.boost.org/LICENSE_1_0.txt
      8  * https://github.com/dlang/dmd/blob/master/src/dmd/import.h
      9  */
     10 
     11 #pragma once
     12 
     13 #include "dsymbol.h"
     14 
     15 class Identifier;
     16 struct Scope;
     17 class Module;
     18 class Package;
     19 
     20 class Import : public Dsymbol
     21 {
     22 public:
     23     /* static import aliasId = pkg1.pkg2.id : alias1 = name1, alias2 = name2;
     24      */
     25 
     26     DArray<Identifier*> packages;      // array of Identifier's representing packages
     27     Identifier *id;             // module Identifier
     28     Identifier *aliasId;
     29     int isstatic;               // !=0 if static import
     30     Visibility visibility;
     31 
     32     // Pairs of alias=name to bind into current namespace
     33     Identifiers names;
     34     Identifiers aliases;
     35 
     36     Module *mod;
     37     Package *pkg;               // leftmost package/module
     38 
     39     AliasDeclarations aliasdecls; // corresponding AliasDeclarations for alias=name pairs
     40 
     41     const char *kind() const;
     42     Visibility visible();
     43     Import *syntaxCopy(Dsymbol *s);    // copy only syntax trees
     44     void load(Scope *sc);
     45     void importAll(Scope *sc);
     46     Dsymbol *toAlias();
     47     void addMember(Scope *sc, ScopeDsymbol *sds);
     48     void setScope(Scope* sc);
     49     Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
     50     bool overloadInsert(Dsymbol *s);
     51 
     52     Import *isImport() { return this; }
     53     void accept(Visitor *v) { v->visit(this); }
     54 };
     55