aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-02-23 23:31:36 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-02-25 00:16:22 +0800
commit38cb123a82dfa0d77c7eb629dfb9307463548a12 (patch)
tree3f3ecdcdcf40dc7b0affbf72f22adc55ae38ff1b /ExpressionCompiler.cpp
parent820ed2dfe17d93a586ba1519333bbe79cc6b9a9c (diff)
downloaddexon-solidity-38cb123a82dfa0d77c7eb629dfb9307463548a12.tar.gz
dexon-solidity-38cb123a82dfa0d77c7eb629dfb9307463548a12.tar.zst
dexon-solidity-38cb123a82dfa0d77c7eb629dfb9307463548a12.zip
Adding location information to assembly items
- In order to facilitate this addition we also now have a ScopeGuard object used in the Compiler to set the currently visited node.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 183864ec..9f8c8bbb 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -75,6 +75,7 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c
bool ExpressionCompiler::visit(Assignment const& _assignment)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_assignment);
_assignment.getRightHandSide().accept(*this);
if (_assignment.getType()->isValueType())
appendTypeConversion(*_assignment.getRightHandSide().getType(), *_assignment.getType());
@@ -99,6 +100,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment)
bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_unaryOperation);
//@todo type checking and creating code for an operator should be in the same place:
// the operator should know how to convert itself and to which types it applies, so
// put this code together with "Type::acceptsBinary/UnaryOperator" into a class that
@@ -163,6 +165,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation)
bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_binaryOperation);
Expression const& leftExpression = _binaryOperation.getLeftExpression();
Expression const& rightExpression = _binaryOperation.getRightExpression();
Type const& commonType = _binaryOperation.getCommonType();
@@ -209,6 +212,7 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_functionCall);
using Location = FunctionType::Location;
if (_functionCall.isTypeConversion())
{
@@ -426,6 +430,7 @@ bool ExpressionCompiler::visit(NewExpression const&)
void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_memberAccess);
ASTString const& member = _memberAccess.getMemberName();
switch (_memberAccess.getExpression().getType()->getCategory())
{
@@ -562,6 +567,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
bool ExpressionCompiler::visit(IndexAccess const& _indexAccess)
{
+ CompilerContext::LocationSetter locationSetter(m_context, &_indexAccess);
_indexAccess.getBaseExpression().accept(*this);
Type const& baseType = *_indexAccess.getBaseExpression().getType();