mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use optional for CompilerStack::Contract source mappings
This commit is contained in:
parent
142a6b0d4f
commit
20c8851f43
@ -582,9 +582,9 @@ string const* CompilerStack::sourceMapping(string const& _contractName) const
|
|||||||
if (!c.sourceMapping)
|
if (!c.sourceMapping)
|
||||||
{
|
{
|
||||||
if (auto items = assemblyItems(_contractName))
|
if (auto items = assemblyItems(_contractName))
|
||||||
c.sourceMapping = make_unique<string>(evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices()));
|
c.sourceMapping.emplace(evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices()));
|
||||||
}
|
}
|
||||||
return c.sourceMapping.get();
|
return c.sourceMapping ? &*c.sourceMapping : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
string const* CompilerStack::runtimeSourceMapping(string const& _contractName) const
|
string const* CompilerStack::runtimeSourceMapping(string const& _contractName) const
|
||||||
@ -596,11 +596,11 @@ string const* CompilerStack::runtimeSourceMapping(string const& _contractName) c
|
|||||||
if (!c.runtimeSourceMapping)
|
if (!c.runtimeSourceMapping)
|
||||||
{
|
{
|
||||||
if (auto items = runtimeAssemblyItems(_contractName))
|
if (auto items = runtimeAssemblyItems(_contractName))
|
||||||
c.runtimeSourceMapping = make_unique<string>(
|
c.runtimeSourceMapping.emplace(
|
||||||
evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices())
|
evmasm::AssemblyItem::computeSourceMapping(*items, sourceIndices())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return c.runtimeSourceMapping.get();
|
return c.runtimeSourceMapping ? &*c.runtimeSourceMapping : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const CompilerStack::filesystemFriendlyName(string const& _contractName) const
|
std::string const CompilerStack::filesystemFriendlyName(string const& _contractName) const
|
||||||
|
@ -348,8 +348,8 @@ private:
|
|||||||
util::LazyInit<Json::Value const> storageLayout;
|
util::LazyInit<Json::Value const> storageLayout;
|
||||||
util::LazyInit<Json::Value const> userDocumentation;
|
util::LazyInit<Json::Value const> userDocumentation;
|
||||||
util::LazyInit<Json::Value const> devDocumentation;
|
util::LazyInit<Json::Value const> devDocumentation;
|
||||||
mutable std::unique_ptr<std::string const> sourceMapping;
|
mutable std::optional<std::string const> sourceMapping;
|
||||||
mutable std::unique_ptr<std::string const> runtimeSourceMapping;
|
mutable std::optional<std::string const> runtimeSourceMapping;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Loads the missing sources from @a _ast (named @a _path) using the callback
|
/// Loads the missing sources from @a _ast (named @a _path) using the callback
|
||||||
|
Loading…
Reference in New Issue
Block a user