ImportIdentifiers

Data type for identifiers in an import declaration. import mod : binds, ...;

Constructors

this
this(Attribute[] attributes, SingleImport si, ImportBind[] binds)
Undocumented in source.

Members

Functions

attrs
auto attrs()
Undocumented in source. Be warned that the author may not have intended to support it.
bindNames
auto bindNames()
Undocumented in source. Be warned that the author may not have intended to support it.
fullName
string fullName()
Undocumented in source. Be warned that the author may not have intended to support it.
names
auto names()
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(ImportIdentifiers that)

Compares identifiers for sorting.

toString
string toString()

Variables

attributes
Attribute[] attributes;
Undocumented in source.
binds
ImportBind[] binds;
Undocumented in source.
singleImport
SingleImport singleImport;
Undocumented in source.

Examples

Test for selective imports.

auto visitor = visitImports(q{
    import foo : aa, bb, cc;
  });
assert(visitor.importGroups[0][0].fullName == "foo");
assert(equal(visitor.importGroups[0][0].bindNames, ["aa", "bb", "cc"]));

Test for renamed imports.

auto visitor = visitImports(q{
    import foo = bar;
    import bar = foo;
    import baz.foo;
    import zz : f = foo;
  });
// Sorting is based on the renamed name if exists.
sort(visitor.importGroups[0]);
assert(visitor.importGroups[0][0].fullName == "bar = foo");
assert(visitor.importGroups[0][1].fullName == "baz.foo");
assert(visitor.importGroups[0][2].fullName == "foo = bar");
assert(visitor.importGroups[0][3].fullName == "zz");

Meta