Merge branch 'develop' into discovery

This commit is contained in:
subtly 2015-04-28 14:19:06 +01:00
commit e3a2d037e4
2 changed files with 20 additions and 2 deletions

View File

@ -3381,6 +3381,26 @@ BOOST_AUTO_TEST_CASE(bytes_index_access)
BOOST_CHECK(callContractFunction("storageWrite()") == encodeArgs(0x193));
}
BOOST_AUTO_TEST_CASE(bytes_delete_element)
{
char const* sourceCode = R"(
contract c {
bytes data;
function test1() external returns (bool) {
data.length = 100;
for (uint i = 0; i < data.length; i++)
data[i] = byte(i);
delete data[94];
delete data[96];
delete data[98];
return data[94] == 0 && data[95] == 95 && data[96] == 0 && data[97] == 97;
}
}
)";
compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("test1()") == encodeArgs(true));
}
BOOST_AUTO_TEST_CASE(array_copy_calldata_storage)
{
char const* sourceCode = R"(

View File

@ -50,14 +50,12 @@ public:
FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); }
Expression* getExpression() const { return m_expression; }
private:
virtual bool visit(Expression& _expression) override { return checkExpression(_expression); }
virtual bool visit(Assignment& _expression) override { return checkExpression(_expression); }
virtual bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); }
virtual bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); }
virtual bool visit(FunctionCall& _expression) override { return checkExpression(_expression); }
virtual bool visit(MemberAccess& _expression) override { return checkExpression(_expression); }
virtual bool visit(IndexAccess& _expression) override { return checkExpression(_expression); }
virtual bool visit(PrimaryExpression& _expression) override { return checkExpression(_expression); }
virtual bool visit(Identifier& _expression) override { return checkExpression(_expression); }
virtual bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); }
virtual bool visit(Literal& _expression) override { return checkExpression(_expression); }