From 9adff68ecc9fe725670c3752429d18d15379644b Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 24 May 2017 18:34:19 +0200 Subject: [PATCH] Introduce LabelID typedef. --- libjulia/backends/evm/AbstractAssembly.h | 8 +++++--- libsolidity/inlineasm/AsmCodeGen.cpp | 4 ++-- libsolidity/inlineasm/AsmScope.h | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libjulia/backends/evm/AbstractAssembly.h b/libjulia/backends/evm/AbstractAssembly.h index e3afa2b6c..de31be28c 100644 --- a/libjulia/backends/evm/AbstractAssembly.h +++ b/libjulia/backends/evm/AbstractAssembly.h @@ -44,6 +44,8 @@ namespace julia class AbstractAssembly { public: + using LabelID = size_t; + virtual ~AbstractAssembly() {} /// Set a new source location valid starting from the next instruction. @@ -56,11 +58,11 @@ public: /// Append a constant. virtual void appendConstant(u256 const& _constant) = 0; /// Append a label. - virtual void appendLabel(size_t _labelId) = 0; + virtual void appendLabel(LabelID _labelId) = 0; /// Append a label reference. - virtual void appendLabelReference(size_t _labelId) = 0; + virtual void appendLabelReference(LabelID _labelId) = 0; /// Generate a new unique label. - virtual size_t newLabelId() = 0; + virtual LabelID newLabelId() = 0; /// Append a reference to a to-be-linked symobl. /// Currently, we assume that the value is always a 20 byte number. virtual void appendLinkerSymbol(std::string const& _name) = 0; diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp index 6a44faaca..af3547fd4 100644 --- a/libsolidity/inlineasm/AsmCodeGen.cpp +++ b/libsolidity/inlineasm/AsmCodeGen.cpp @@ -70,12 +70,12 @@ public: m_assembly.append(_constant); } /// Append a label. - virtual void appendLabel(size_t _labelId) override + virtual void appendLabel(LabelID _labelId) override { m_assembly.append(eth::AssemblyItem(eth::Tag, _labelId)); } /// 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)); } diff --git a/libsolidity/inlineasm/AsmScope.h b/libsolidity/inlineasm/AsmScope.h index 70786dce9..498218b49 100644 --- a/libsolidity/inlineasm/AsmScope.h +++ b/libsolidity/inlineasm/AsmScope.h @@ -63,6 +63,7 @@ struct GenericVisitor<>: public boost::static_visitor<> { struct Scope { using JuliaType = std::string; + using LabelID = size_t; struct Variable { @@ -76,7 +77,7 @@ struct Scope struct Label { - boost::optional id; + boost::optional id; }; struct Function