class Dependencies

Defined at line 864 of file ../../tools/fidl/fidlc/src/flat_ast.h

This class is used to manage a library's set of direct dependencies, i.e.

those imported with "using" statements.

Public Methods

RegisterResult Register (const SourceSpan & span, std::string_view filename, Library * dep_library, const std::unique_ptr<RawIdentifier> & maybe_alias)

Registers a dependency to a library. The registration name is |maybe_alias|

if provided, otherwise the library's name. Afterwards, Dependencies::Lookup

will return |dep_library| given the registration name.

bool Contains (std::string_view filename, std::string_view library_name)

Returns true if this dependency set contains a library with the given name and filename.

Library * LookupAndMarkUsed (std::string_view filename, std::string_view library_name)

Looks up a dependency by filename (within the importing library, since

"using" statements are file-scoped) and name (of the imported library).

Also marks the library as used. Returns null if no library is found.

void VerifyAllDependenciesWereUsed (const Library * for_library, Reporter * reporter)

VerifyAllDependenciesWereUsed reports an error for each dependency imported

with `using` that was never used in the file.

const std::set<Library *> & all ()

Returns all the dependencies.

Defined at line 891 of file ../../tools/fidl/fidlc/src/flat_ast.h

std::vector<std::pair<Library *, SourceSpan>> library_references ()

Defined at line 893 of file ../../tools/fidl/fidlc/src/flat_ast.h

Enumerations

enum RegisterResult
Name Value
kSuccess 0
kDuplicate 1
kCollision 2

Defined at line 866 of file ../../tools/fidl/fidlc/src/flat_ast.h