blob: 0e063caa2fcde165181fa89a887b8060ae88b3a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/**
* Implements the `alias this` symbol.
*
* Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This)
*
* Copyright: Copyright (C) 1999-2024 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/aliasthis.d, _aliasthis.d)
* Documentation: https://dlang.org/phobos/dmd_aliasthis.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/aliasthis.d
*/
module dmd.aliasthis;
import core.stdc.stdio;
import dmd.dsymbol;
import dmd.identifier;
import dmd.location;
import dmd.visitor;
/***********************************************************
* alias ident this;
*/
extern (C++) final class AliasThis : Dsymbol
{
Identifier ident;
/// The symbol this `alias this` resolves to
Dsymbol sym;
/// Whether this `alias this` is deprecated or not
bool isDeprecated_;
extern (D) this(const ref Loc loc, Identifier ident) @safe
{
super(loc, null); // it's anonymous (no identifier)
this.ident = ident;
}
override AliasThis syntaxCopy(Dsymbol s)
{
assert(!s);
auto at = new AliasThis(loc, ident);
at.comment = comment;
return at;
}
override const(char)* kind() const
{
return "alias this";
}
AliasThis isAliasThis()
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
override bool isDeprecated() const
{
return this.isDeprecated_;
}
}
|