JuliaType -> YulType

This commit is contained in:
Alex Beregszaszi 2018-06-12 18:38:17 +01:00
parent e0d95a6641
commit e1d0bfe1ca
3 changed files with 11 additions and 11 deletions

View File

@ -32,7 +32,7 @@ bool Scope::registerLabel(string const& _name)
return true; return true;
} }
bool Scope::registerVariable(string const& _name, JuliaType const& _type) bool Scope::registerVariable(string const& _name, YulType const& _type)
{ {
if (exists(_name)) if (exists(_name))
return false; return false;
@ -42,7 +42,7 @@ bool Scope::registerVariable(string const& _name, JuliaType const& _type)
return true; return true;
} }
bool Scope::registerFunction(string const& _name, std::vector<JuliaType> const& _arguments, std::vector<JuliaType> const& _returns) bool Scope::registerFunction(string const& _name, std::vector<YulType> const& _arguments, std::vector<YulType> const& _returns)
{ {
if (exists(_name)) if (exists(_name))
return false; return false;

View File

@ -62,27 +62,27 @@ struct GenericVisitor<>: public boost::static_visitor<> {
struct Scope struct Scope
{ {
using JuliaType = std::string; using YulType = std::string;
using LabelID = size_t; using LabelID = size_t;
struct Variable { JuliaType type; }; struct Variable { YulType type; };
struct Label { }; struct Label { };
struct Function struct Function
{ {
std::vector<JuliaType> arguments; std::vector<YulType> arguments;
std::vector<JuliaType> returns; std::vector<YulType> returns;
}; };
using Identifier = boost::variant<Variable, Label, Function>; using Identifier = boost::variant<Variable, Label, Function>;
using Visitor = GenericVisitor<Variable const, Label const, Function const>; using Visitor = GenericVisitor<Variable const, Label const, Function const>;
using NonconstVisitor = GenericVisitor<Variable, Label, Function>; using NonconstVisitor = GenericVisitor<Variable, Label, Function>;
bool registerVariable(std::string const& _name, JuliaType const& _type); bool registerVariable(std::string const& _name, YulType const& _type);
bool registerLabel(std::string const& _name); bool registerLabel(std::string const& _name);
bool registerFunction( bool registerFunction(
std::string const& _name, std::string const& _name,
std::vector<JuliaType> const& _arguments, std::vector<YulType> const& _arguments,
std::vector<JuliaType> const& _returns std::vector<YulType> const& _returns
); );
/// Looks up the identifier in this or super scopes and returns a valid pointer if found /// Looks up the identifier in this or super scopes and returns a valid pointer if found

View File

@ -75,10 +75,10 @@ bool ScopeFiller::operator()(assembly::VariableDeclaration const& _varDecl)
bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef) bool ScopeFiller::operator()(assembly::FunctionDefinition const& _funDef)
{ {
bool success = true; bool success = true;
vector<Scope::JuliaType> arguments; vector<Scope::YulType> arguments;
for (auto const& _argument: _funDef.parameters) for (auto const& _argument: _funDef.parameters)
arguments.push_back(_argument.type); arguments.push_back(_argument.type);
vector<Scope::JuliaType> returns; vector<Scope::YulType> returns;
for (auto const& _return: _funDef.returnVariables) for (auto const& _return: _funDef.returnVariables)
returns.push_back(_return.type); returns.push_back(_return.type);
if (!m_currentScope->registerFunction(_funDef.name, arguments, returns)) if (!m_currentScope->registerFunction(_funDef.name, arguments, returns))