[yul] Functions: Remove dependency on AST ID.

This commit is contained in:
Alexander Arlt
2021-06-23 16:15:25 +02:00
committed by chriseth
parent e4cf371358
commit 8accf420ea
6 changed files with 64 additions and 24 deletions
@@ -152,6 +152,14 @@ public:
bool inlineAssemblySeen() const { return m_inlineAssemblySeen; }
void setInlineAssemblySeen() { m_inlineAssemblySeen = true; }
/// @returns the runtime ID to be used for the function in the dispatch routine
/// and for internal function pointers.
/// @param _requirePresent if false, generates a new ID if not yet done.
uint64_t internalFunctionID(FunctionDefinition const& _function, bool _requirePresent);
/// Copies the internal function IDs from the @a _other. For use in transferring
/// function IDs from constructor code to deployed code.
void copyFunctionIDsFrom(IRGenerationContext const& _other);
std::map<std::string, unsigned> const& sourceIndices() const { return m_sourceIndices; }
private:
@@ -191,6 +199,8 @@ private:
/// the code contains a call via a pointer even though a specific function is never assigned to it.
/// It will fail at runtime but the code must still compile.
InternalDispatchMap m_internalDispatchMap;
/// Map used by @a internalFunctionID.
std::map<int64_t, uint64_t> m_functionIDs;
std::set<ContractDefinition const*, ASTNode::CompareByID> m_subObjects;
};