Implements the alias this symbol.

Specification: Alias This


Walter Bright

Source: aliasthis.d

  • Declaration

    class AliasThis: dmd.dsymbol.Dsymbol;

    alias ident this;

    • sym


      Dsymbol sym;

      The symbol this alias this resolves to

    • Declaration

      bool isDeprecated_;

      Whether this alias this is deprecated or not

  • Declaration

    Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool findOnly = false);

    Find the alias this symbol of e's type.


    Scope* sc


    Expression e

    expression forming the this

    bool gag

    if true do not print errors, return null instead

    bool findOnly

    don't do further processing like resolving properties, i.e. just return plain dotExp() result.

    Return Value

    Expression that is e.aliasthis

  • Declaration

    bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc);

    Check if an alias this is deprecated


    Usually one would use expression.checkDeprecated(scope, aliasthis) to check if expression uses a deprecated aliasthis, but this calls toPrettyChars which lead to the following message: "Deprecation: alias this fullyqualified.aggregate.__anonymous is deprecated"


    AliasThis at

    The AliasThis object to check

    Loc loc

    Loc of the expression triggering the access to at

    Scope* sc

    Scope of the expression (deprecations do not trigger in deprecated scopes)

    Return Value

    Whether the alias this was reported as deprecated.

  • Declaration

    bool isRecursiveAliasThis(ref Type att, Type t);

    Check and set 'att' if 't' is a recursive 'alias this' type


    Type att

    type reference used to detect recursion

    Type t

    'alias this' type

    Return Value

    Whether the 'alias this' is recursive or not