Refactoring: Check types outside of AST and recover from some errors.

This commit is contained in:
chriseth
2015-09-21 20:03:05 +02:00
parent 352c196eb3
commit 34a81fd60e
33 changed files with 2295 additions and 1802 deletions
+9 -9
View File
@@ -232,19 +232,19 @@ bool ASTJsonConverter::visit(UnaryOperation const& _node)
bool ASTJsonConverter::visit(BinaryOperation const& _node)
{
addJsonNode("BinaryOperation",
{ make_pair("operator", Token::toString(_node.getOperator())),
make_pair("type", type(_node))},
true);
addJsonNode("BinaryOperation", {
make_pair("operator", Token::toString(_node.getOperator())),
make_pair("type", type(_node))
}, true);
return true;
}
bool ASTJsonConverter::visit(FunctionCall const& _node)
{
addJsonNode("FunctionCall",
{ make_pair("type_conversion", boost::lexical_cast<std::string>(_node.isTypeConversion())),
make_pair("type", type(_node)) },
true);
addJsonNode("FunctionCall", {
make_pair("type_conversion", boost::lexical_cast<std::string>(_node.annotation().isTypeConversion)),
make_pair("type", type(_node))
}, true);
return true;
}
@@ -441,7 +441,7 @@ void ASTJsonConverter::process()
string ASTJsonConverter::type(Expression const& _expression)
{
return (_expression.type()) ? _expression.type()->toString() : "Unknown";
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
}
}