aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-16 17:28:35 +0800
committerchriseth <c@ethdev.com>2015-06-16 17:28:35 +0800
commita5664d053589bb512c1b9acba7feb6b1c6db155f (patch)
tree8e1f943b3ce84c02b1b60e203fb7e97ad58c2ba6
parent8b402b5879b3f6851d8ca59eed0ac55fc08dd422 (diff)
downloaddexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar.gz
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar.bz2
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar.lz
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar.xz
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.tar.zst
dexon-solidity-a5664d053589bb512c1b9acba7feb6b1c6db155f.zip
Style.
-rw-r--r--CompilerUtils.cpp36
-rw-r--r--ExpressionCompiler.cpp20
2 files changed, 33 insertions, 23 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp
index 6110fdf7..349877a2 100644
--- a/CompilerUtils.cpp
+++ b/CompilerUtils.cpp
@@ -110,11 +110,11 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound
if (type.location() == ReferenceType::Location::CallData)
{
// stack: target source_offset source_len
- m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 << eth::Instruction::DUP5
+ m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 << eth::Instruction::DUP5;
// stack: target source_offset source_len source_len source_offset target
- << eth::Instruction::CALLDATACOPY
- << eth::Instruction::DUP3 << eth::Instruction::ADD
- << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP;
+ m_context << eth::Instruction::CALLDATACOPY;
+ m_context << eth::Instruction::DUP3 << eth::Instruction::ADD;
+ m_context << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP;
}
else if (type.location() == ReferenceType::Location::Memory)
{
@@ -200,16 +200,16 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound
// stack here: memory_end_offset storage_data_offset memory_offset
eth::AssemblyItem loopStart = m_context.newTag();
- m_context << loopStart
- // load and store
- << eth::Instruction::DUP2 << eth::Instruction::SLOAD
- << eth::Instruction::DUP2 << eth::Instruction::MSTORE
- // increment storage_data_offset by 1
- << eth::Instruction::SWAP1 << u256(1) << eth::Instruction::ADD
- // increment memory offset by 32
- << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD
- // check for loop condition
- << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::GT;
+ m_context << loopStart;
+ // load and store
+ m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD;
+ m_context << eth::Instruction::DUP2 << eth::Instruction::MSTORE;
+ // increment storage_data_offset by 1
+ m_context << eth::Instruction::SWAP1 << u256(1) << eth::Instruction::ADD;
+ // increment memory offset by 32
+ m_context << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD;
+ // check for loop condition
+ m_context << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::GT;
m_context.appendConditionalJumpTo(loopStart);
// stack here: memory_end_offset storage_data_offset memory_offset
if (_padToWordBoundaries)
@@ -368,9 +368,11 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
if (targetType.getNumBytes() == 0)
m_context << eth::Instruction::DUP1 << eth::Instruction::XOR;
else
- m_context << (u256(1) << (256 - targetType.getNumBytes() * 8))
- << eth::Instruction::DUP1 << eth::Instruction::SWAP2
- << eth::Instruction::DIV << eth::Instruction::MUL;
+ {
+ m_context << (u256(1) << (256 - targetType.getNumBytes() * 8));
+ m_context << eth::Instruction::DUP1 << eth::Instruction::SWAP2;
+ m_context << eth::Instruction::DIV << eth::Instruction::MUL;
+ }
}
}
}
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index d5ffd35b..12274c7a 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -436,8 +436,10 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
_functionCall.getExpression().accept(*this);
m_context << u256(0); // do not send gas (there still is the stipend)
arguments.front()->accept(*this);
- utils().convertType(*arguments.front()->getType(),
- *function.getParameterTypes().front(), true);
+ utils().convertType(
+ *arguments.front()->getType(),
+ *function.getParameterTypes().front(), true
+ );
appendExternalFunctionCall(
FunctionType(
TypePointers{},
@@ -612,13 +614,19 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
case Type::Category::Integer:
if (member == "balance")
{
- utils().convertType(*_memberAccess.getExpression().getType(),
- IntegerType(0, IntegerType::Modifier::Address), true);
+ utils().convertType(
+ *_memberAccess.getExpression().getType(),
+ IntegerType(0, IntegerType::Modifier::Address),
+ true
+ );
m_context << eth::Instruction::BALANCE;
}
else if ((set<string>{"send", "call", "callcode"}).count(member))
- utils().convertType(*_memberAccess.getExpression().getType(),
- IntegerType(0, IntegerType::Modifier::Address), true);
+ utils().convertType(
+ *_memberAccess.getExpression().getType(),
+ IntegerType(0, IntegerType::Modifier::Address),
+ true
+ );
else
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to integer."));
break;