aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmPrinter.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-04-27 06:58:34 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-06 05:31:22 +0800
commitd6396ee85fd21424568074c41a131e8c52961983 (patch)
treecc0fa48f71be625bc40f67ee15ca0ef903f84fbc /libsolidity/inlineasm/AsmPrinter.cpp
parentb0f2a5c162480ab6ecdc5e1397567242a137768a (diff)
downloaddexon-solidity-d6396ee85fd21424568074c41a131e8c52961983.tar.gz
dexon-solidity-d6396ee85fd21424568074c41a131e8c52961983.tar.zst
dexon-solidity-d6396ee85fd21424568074c41a131e8c52961983.zip
Parse types in Julia mode
Diffstat (limited to 'libsolidity/inlineasm/AsmPrinter.cpp')
-rw-r--r--libsolidity/inlineasm/AsmPrinter.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/libsolidity/inlineasm/AsmPrinter.cpp b/libsolidity/inlineasm/AsmPrinter.cpp
index 4a6f975d..94829371 100644
--- a/libsolidity/inlineasm/AsmPrinter.cpp
+++ b/libsolidity/inlineasm/AsmPrinter.cpp
@@ -47,7 +47,7 @@ string AsmPrinter::operator()(assembly::Instruction const& _instruction)
string AsmPrinter::operator()(assembly::Literal const& _literal)
{
if (_literal.isNumber)
- return _literal.value;
+ return _literal.value + appendTypeName(_literal.type);
string out;
for (char c: _literal.value)
if (c == '\\')
@@ -74,7 +74,7 @@ string AsmPrinter::operator()(assembly::Literal const& _literal)
}
else
out += c;
- return "\"" + out + "\"";
+ return "\"" + out + "\"" + appendTypeName(_literal.type);
}
string AsmPrinter::operator()(assembly::Identifier const& _identifier)
@@ -113,14 +113,22 @@ string AsmPrinter::operator()(assembly::FunctionalAssignment const& _functionalA
string AsmPrinter::operator()(assembly::VariableDeclaration const& _variableDeclaration)
{
- return "let " + _variableDeclaration.name + " := " + boost::apply_visitor(*this, *_variableDeclaration.value);
+ return "let " + _variableDeclaration.variable.name + appendTypeName(_variableDeclaration.variable.type) + " := " + boost::apply_visitor(*this, *_variableDeclaration.value);
}
string AsmPrinter::operator()(assembly::FunctionDefinition const& _functionDefinition)
{
- string out = "function " + _functionDefinition.name + "(" + boost::algorithm::join(_functionDefinition.arguments, ", ") + ")";
+ string out = "function " + _functionDefinition.name + "(";
+ for (auto const& argument: _functionDefinition.arguments)
+ out += argument.name + appendTypeName(argument.type) + ",";
+ out += ")";
if (!_functionDefinition.returns.empty())
- out += " -> " + boost::algorithm::join(_functionDefinition.returns, ", ");
+ {
+ out += " -> ";
+ for (auto const& argument: _functionDefinition.returns)
+ out += argument.name + appendTypeName(argument.type) + ",";
+ }
+
return out + "\n" + (*this)(_functionDefinition.body);
}
@@ -145,3 +153,10 @@ string AsmPrinter::operator()(Block const& _block)
boost::replace_all(body, "\n", "\n ");
return "{\n " + body + "\n}";
}
+
+string AsmPrinter::appendTypeName(std::string const& _type)
+{
+ if (m_julia)
+ return ":" + _type;
+ return "";
+}