mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2321 from ethereum/labelid_typedef
Introduce LabelID typedef.
This commit is contained in:
commit
9822deeed9
@ -44,6 +44,8 @@ namespace julia
|
|||||||
class AbstractAssembly
|
class AbstractAssembly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using LabelID = size_t;
|
||||||
|
|
||||||
virtual ~AbstractAssembly() {}
|
virtual ~AbstractAssembly() {}
|
||||||
|
|
||||||
/// Set a new source location valid starting from the next instruction.
|
/// Set a new source location valid starting from the next instruction.
|
||||||
@ -56,11 +58,11 @@ public:
|
|||||||
/// Append a constant.
|
/// Append a constant.
|
||||||
virtual void appendConstant(u256 const& _constant) = 0;
|
virtual void appendConstant(u256 const& _constant) = 0;
|
||||||
/// Append a label.
|
/// Append a label.
|
||||||
virtual void appendLabel(size_t _labelId) = 0;
|
virtual void appendLabel(LabelID _labelId) = 0;
|
||||||
/// Append a label reference.
|
/// Append a label reference.
|
||||||
virtual void appendLabelReference(size_t _labelId) = 0;
|
virtual void appendLabelReference(LabelID _labelId) = 0;
|
||||||
/// Generate a new unique label.
|
/// Generate a new unique label.
|
||||||
virtual size_t newLabelId() = 0;
|
virtual LabelID newLabelId() = 0;
|
||||||
/// Append a reference to a to-be-linked symobl.
|
/// Append a reference to a to-be-linked symobl.
|
||||||
/// Currently, we assume that the value is always a 20 byte number.
|
/// Currently, we assume that the value is always a 20 byte number.
|
||||||
virtual void appendLinkerSymbol(std::string const& _name) = 0;
|
virtual void appendLinkerSymbol(std::string const& _name) = 0;
|
||||||
|
@ -70,12 +70,12 @@ public:
|
|||||||
m_assembly.append(_constant);
|
m_assembly.append(_constant);
|
||||||
}
|
}
|
||||||
/// Append a label.
|
/// Append a label.
|
||||||
virtual void appendLabel(size_t _labelId) override
|
virtual void appendLabel(LabelID _labelId) override
|
||||||
{
|
{
|
||||||
m_assembly.append(eth::AssemblyItem(eth::Tag, _labelId));
|
m_assembly.append(eth::AssemblyItem(eth::Tag, _labelId));
|
||||||
}
|
}
|
||||||
/// Append a label reference.
|
/// Append a label reference.
|
||||||
virtual void appendLabelReference(size_t _labelId) override
|
virtual void appendLabelReference(LabelID _labelId) override
|
||||||
{
|
{
|
||||||
m_assembly.append(eth::AssemblyItem(eth::PushTag, _labelId));
|
m_assembly.append(eth::AssemblyItem(eth::PushTag, _labelId));
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ struct GenericVisitor<>: public boost::static_visitor<> {
|
|||||||
struct Scope
|
struct Scope
|
||||||
{
|
{
|
||||||
using JuliaType = std::string;
|
using JuliaType = std::string;
|
||||||
|
using LabelID = size_t;
|
||||||
|
|
||||||
struct Variable
|
struct Variable
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ struct Scope
|
|||||||
|
|
||||||
struct Label
|
struct Label
|
||||||
{
|
{
|
||||||
boost::optional<size_t> id;
|
boost::optional<LabelID> id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Function
|
struct Function
|
||||||
|
Loading…
Reference in New Issue
Block a user