]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/import.h
Merge dmd upstream 6243fa6d2
[thirdparty/gcc.git] / gcc / d / dmd / import.h
1
2 /* Compiler implementation of the D programming language
3 * Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved
4 * written by Walter Bright
5 * http://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * http://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 class AliasDeclaration;
20
21 class Import : public Dsymbol
22 {
23 public:
24 /* static import aliasId = pkg1.pkg2.id : alias1 = name1, alias2 = name2;
25 */
26
27 Identifiers *packages; // array of Identifier's representing packages
28 Identifier *id; // module Identifier
29 Identifier *aliasId;
30 int isstatic; // !=0 if static import
31 Prot protection;
32
33 // Pairs of alias=name to bind into current namespace
34 Identifiers names;
35 Identifiers aliases;
36
37 Module *mod;
38 Package *pkg; // leftmost package/module
39
40 AliasDeclarations aliasdecls; // corresponding AliasDeclarations for alias=name pairs
41
42 Import(Loc loc, Identifiers *packages, Identifier *id, Identifier *aliasId,
43 int isstatic);
44 void addAlias(Identifier *name, Identifier *alias);
45 const char *kind() const;
46 Prot prot();
47 Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees
48 void load(Scope *sc);
49 void importAll(Scope *sc);
50 void semantic(Scope *sc);
51 void semantic2(Scope *sc);
52 Dsymbol *toAlias();
53 void addMember(Scope *sc, ScopeDsymbol *sds);
54 void setScope(Scope* sc);
55 Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
56 bool overloadInsert(Dsymbol *s);
57
58 Import *isImport() { return this; }
59 void accept(Visitor *v) { v->visit(this); }
60 };