| 1 |
|
| 2 |
/* Compiler implementation of the D programming language |
| 3 |
* Copyright (C) 1999-2025 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 final : 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 override; |
| 42 |
Visibility visible() override; |
| 43 |
Import *syntaxCopy(Dsymbol *s) override; // copy only syntax trees |
| 44 |
Dsymbol *toAlias() override; |
| 45 |
bool overloadInsert(Dsymbol *s) override; |
| 46 |
|
| 47 |
void accept(Visitor *v) override { v->visit(this); } |
| 48 |
}; |