Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

dmd.dsymbol

The base class for a D symbol, which can be a module, variable, function, enum, etc.
Authors:
Walter Bright
License:
Boost License 1.0

Sourcedsymbol.d

Documentationhttps://dlang.org/phobos/dmd_dsymbol.html

Coveragehttps://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dsymbol.d

intforeachDsymbol(Dsymbols*symbols, scope int delegate(Dsymbol)dg);
Calls dg(Dsymbol* sym) for each Dsymbol. If dg returns !=0, stops and returns that value else returns 0.
Parameters:
Dsymbols*symbolsDsymbols
int delegate(Dsymbol)dgdelegate to call for each Dsymbol
Returns:
last value returned by dg()
See Also:
voidforeachDsymbol(Dsymbols*symbols, scope void delegate(Dsymbol)dg);
Calls dg(Dsymbol* sym) for each Dsymbol.
Parameters:
Dsymbols*symbolsDsymbols
void delegate(Dsymbol)dgdelegate to call for each Dsymbol
See Also:
structFieldState;
Struct/Class/Union field state. Used for transitory information when setting field offsets, such as bit fields.
uintoffset;
byte offset for next field
uintfieldOffset;
byte offset for the start of the bit field
uintfieldSize;
byte size of field
uintfieldAlign;
byte alignment of field
uintbitOffset;
bit offset for field
boolinFlight;
bit field is in flight
classDsymbol:dmd.ast_node.ASTNode;
ushortlocalNum;
perturb mangled name to avoid collisions with those in FuncDeclaration.localsymtab
final ModulegetModule();
Determine which Module a Dsymbol is in.
final boolisCsymbol();
Does this Dsymbol come from a C file?
Returns:
true if it does
final ModulegetAccessModule();
Determine which Module a Dsymbol is in, as far as access rights go.
final @safe inout(Dsymbol)pastMixin() inout;
pastMixin returns the enclosing symbol if this is a template mixin.
pastMixinAndNspace does likewise, additionally skipping over Nspaces that are mangleOnly.
See alsoparent,toParent andtoParent2.
final @safe inout(Dsymbol)toParent() inout;

final @safe inout(Dsymbol)toParent2() inout;

final inout(Dsymbol)toParentDecl() inout;

final inout(Dsymbol)toParentLocal() inout;
parent field returns a lexically enclosing scope symbol this is a member of.
toParent() returns a logically enclosing scope symbol this is a member of. It skips over TemplateMixin's.
toParent2() returns an enclosing scope symbol this is living at runtime. It skips over both TemplateInstance's and TemplateMixin's. It's used when looking for the 'this' pointer of the enclosing function/class.
toParentDecl() similar totoParent2() but always follows the template declaration scope instead of the instantiation scope.
toParentLocal() similar totoParentDecl() but follows the instantiation scope if a template declaration is non-local i.e. global or static.
Examples:
module mod;template Foo(alias a) {mixin Bar!(); }mixintemplate Bar() {public {// VisibilityDeclarationvoid baz() { a = 2; }   } }void test() {int v = 1;alias foo = Foo!(v);   foo.baz();assert(v == 2); }// s == FuncDeclaration('mod.test.Foo!().Bar!().baz()')// s.parent == TemplateMixin('mod.test.Foo!().Bar!()')// s.toParent() == TemplateInstance('mod.test.Foo!()')// s.toParent2() == FuncDeclaration('mod.test')// s.toParentDecl() == Module('mod')// s.toParentLocal() == FuncDeclaration('mod.test')
static Dsymbols*arraySyntaxCopy(Dsymbols*a);
Do syntax copy of an array of Dsymbol's.
final inout(AggregateDeclaration)isMember() inout;
Returns an AggregateDeclaration when toParent() is that.
final inout(AggregateDeclaration)isMember2() inout;
Returns an AggregateDeclaration when toParent2() is that.
final inout(AggregateDeclaration)isMemberDecl() inout;
Returns an AggregateDeclaration when toParentDecl() is that.
final inout(AggregateDeclaration)isMemberLocal() inout;
Returns an AggregateDeclaration when toParentLocal() is that.
pure nothrow @nogc @safe Visibilityvisible();
DsymbolsyntaxCopy(Dsymbols);
Copy the syntax. Used for template instantiations. If s is NULL, allocate the new object, otherwise fill it in.
voidaddComment(const(char)*comment);
Add documentation comment to Dsymbol. Ignore NULL comments.
final const(char)*comment();
get documentation comment for this Dsymbol
final UnitTestDeclarationddocUnittest();
Get ddoc unittest associated with this symbol. (only use this with ddoc)
Returns:
ddoc unittest, null if none
final voidddocUnittest(UnitTestDeclarationutd);
Set ddoc unittest associated with this symbol.
final boolinNonRoot();
Returns true if this symbol is defined in a non-root module without instantiation.
static voiddeinitialize();
Deinitializes the global state of the compiler.
This can be used to restore the state set by_init to its original state.
voidaccept(Visitorv);
classScopeDsymbol:dmd.dsymbol.Dsymbol;
Dsymbol that generates a scope
Dsymbols*importedScopes;
symbols whose members have been imported, i.e. imported modules and template mixins
final pure nothrow @nogc @safe Dsymbols*getImportedScopes();
Returns:
the symbols whose members have been imported, i.e. imported modules and template mixins.
See Also:
importScope
final pure nothrow @nogc @safe Visibility.Kind[]getImportVisibilities();
Returns:
the array of visibilities associated with each imported scope. The length of the array matches the imported scopes array.
See Also:
getImportedScopes
nothrow DsymbolsymtabInsert(Dsymbols);
Insert Dsymbol in table.
Parameters:
Dsymbolssymbol to add
Returns:
null if already in table,s if inserted
nothrow DsymbolsymtabLookup(Dsymbols, Identifierid);
Look up identifier in symbol table.
Parameters:
Dsymbolssymbol
Identifierididentifier to look up
Returns:
Dsymbol if found, null if not
classWithScopeSymbol:dmd.dsymbol.ScopeDsymbol;
With statement scope
classArrayScopeSymbol:dmd.dsymbol.ScopeDsymbol;
Array Index/Slice scope
classOverloadSet:dmd.dsymbol.Dsymbol;
Overload Sets
classForwardingScopeDsymbol:dmd.dsymbol.ScopeDsymbol;
Forwarding ScopeDsymbol. Used by ForwardingAttribDeclaration and ForwardingScopeDeclaration to forward symbol insertions to another scope. Seedmd.attrib.ForwardingAttribDeclaration for more details.
nothrow DsymbolsymtabLookup(Dsymbols, Identifierid);
This override handles the following two cases: static foreach (i, i; [0]) { ... } and static foreach (i; [0]) { enum i = 2; }
classExpressionDsymbol:dmd.dsymbol.Dsymbol;
Class that holds an expression in a Dsymbol wrapper. This is not an AST node, but a class used to pass an expression as a function parameter of type Dsymbol.
classAliasAssign:dmd.dsymbol.Dsymbol;
Encapsulate assigning to an alias:identifier = type;identifier = symbol; whereidentifier is an AliasDeclaration in scope.
Identifierident;
Dsymbol's ident will be null, as this class is anonymous
Typetype;
replace previous RHS of AliasDeclaration withtype
Dsymbolaliassym;
replace previous RHS of AliasDeclaration withaliassym
nothrow @safe this(Locloc, Identifierident, Typetype, Dsymbolaliassym);
only one of type and aliassym can be != null
classDsymbolTable:dmd.rootobject.RootObject;
Table of Dsymbol's
nothrow Dsymbollookup(const Identifierident);
Look up Identifier in symbol table
Parameters:
Identifieridentidentifer to look up
Returns:
Dsymbol if found, null if not
nothrow voidupdate(Dsymbols);
Replace existing symbol in symbol table withs. If it's not there, add it.
Parameters:
Dsymbolsreplacement symbol with same identifier
nothrow Dsymbolinsert(Dsymbols);
Insert Dsymbol in table.
Parameters:
Dsymbolssymbol to add
Returns:
null if already in table,s if inserted
nothrow Dsymbolinsert(const Identifierident, Dsymbols);
Insert Dsymbol in table.
Parameters:
Identifieridentidentifier to serve as index
Dsymbolssymbol to add
Returns:
null if already in table,s if inserted
pure nothrow size_tlength() const;
Returns:
number of symbols in symbol table
classCAsmDeclaration:dmd.dsymbol.Dsymbol;
ImportC globalasm definition.
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Sat Feb 21 00:04:56 2026

[8]ページ先頭

©2009-2026 Movatter.jp