mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Create a state struct.
This commit is contained in:
@@ -101,9 +101,9 @@ public:
|
||||
void operator()(Block& _block) override;
|
||||
|
||||
/// @returns the current value of the given variable, if known - always movable.
|
||||
AssignedValue const* variableValue(YulString _variable) const { return util::valueOrNullptr(m_value, _variable); }
|
||||
std::set<YulString> const* references(YulString _variable) const { return util::valueOrNullptr(m_references, _variable); }
|
||||
std::map<YulString, AssignedValue> const& allValues() const { return m_value; }
|
||||
AssignedValue const* variableValue(YulString _variable) const { return util::valueOrNullptr(m_state.value, _variable); }
|
||||
std::set<YulString> const* references(YulString _variable) const { return util::valueOrNullptr(m_state.references, _variable); }
|
||||
std::map<YulString, AssignedValue> const& allValues() const { return m_state.value; }
|
||||
std::optional<YulString> storageValue(YulString _key) const;
|
||||
std::optional<YulString> memoryValue(YulString _key) const;
|
||||
|
||||
@@ -173,14 +173,20 @@ protected:
|
||||
/// if this is not provided or the function is not found.
|
||||
std::map<YulString, SideEffects> m_functionSideEffects;
|
||||
|
||||
/// Current values of variables, always movable.
|
||||
std::map<YulString, AssignedValue> m_value;
|
||||
/// m_references[a].contains(b) <=> the current expression assigned to a references b
|
||||
std::unordered_map<YulString, std::set<YulString>> m_references;
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
/// Current values of variables, always movable.
|
||||
std::map<YulString, AssignedValue> value;
|
||||
/// m_references[a].contains(b) <=> the current expression assigned to a references b
|
||||
std::unordered_map<YulString, std::set<YulString>> references;
|
||||
|
||||
std::unordered_map<YulString, YulString> m_storage;
|
||||
std::unordered_map<YulString, YulString> m_memory;
|
||||
std::unordered_map<YulString, YulString> storage;
|
||||
std::unordered_map<YulString, YulString> memory;
|
||||
};
|
||||
State m_state;
|
||||
|
||||
protected:
|
||||
KnowledgeBase m_knowledgeBase;
|
||||
|
||||
YulString m_storeFunctionName[static_cast<unsigned>(StoreLoadLocation::Last) + 1];
|
||||
|
||||
Reference in New Issue
Block a user