mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Clarify FileReader interface.
This commit is contained in:
@@ -61,18 +61,17 @@ public:
|
||||
void allowDirectory(boost::filesystem::path _path);
|
||||
FileSystemPathSet const& allowedDirectories() const noexcept { return m_allowedDirectories; }
|
||||
|
||||
StringMap const& sourceCodes() const noexcept { return m_sourceCodes; }
|
||||
|
||||
/// Retrieves the source code for a given source unit name.
|
||||
SourceCode const& sourceCode(SourceUnitName const& _sourceUnitName) const { return m_sourceCodes.at(_sourceUnitName); }
|
||||
/// @returns all sources by their internal source unit names.
|
||||
StringMap const& sourceUnits() const noexcept { return m_sourceCodes; }
|
||||
|
||||
/// Resets all sources to the given map of source unit name to source codes.
|
||||
/// Does not enforce @a allowedDirectories().
|
||||
void setSources(StringMap _sources);
|
||||
void setSourceUnits(StringMap _sources);
|
||||
|
||||
/// Adds the source code under a source unit name created by normalizing the file path.
|
||||
/// Adds the source code under a source unit name created by normalizing the file path
|
||||
/// or changes an existing source.
|
||||
/// Does not enforce @a allowedDirectories().
|
||||
void setSource(boost::filesystem::path const& _path, SourceCode _source);
|
||||
void addOrUpdateFile(boost::filesystem::path const& _path, SourceCode _source);
|
||||
|
||||
/// Adds the source code under the source unit name of @a <stdin>.
|
||||
/// Does not enforce @a allowedDirectories().
|
||||
@@ -83,7 +82,7 @@ public:
|
||||
/// The read will only succeed if the canonical path of the file is within one of the @a allowedDirectories().
|
||||
/// @param _kind must be equal to "source". Other values are not supported.
|
||||
/// @return Content of the loaded file or an error message. If the operation succeeds, a copy of
|
||||
/// the content is retained in @a sourceCodes() under the key of @a _sourceUnitName. If the key
|
||||
/// the content is retained in @a sourceUnits() under the key of @a _sourceUnitName. If the key
|
||||
/// already exists, previous content is discarded.
|
||||
frontend::ReadCallback::Result readFile(std::string const& _kind, std::string const& _sourceUnitName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user