aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityCompiler.cpp
diff options
context:
space:
mode:
authorwinsvega <winsvega@mail.ru>2015-02-01 04:25:18 +0800
committerwinsvega <winsvega@mail.ru>2015-02-01 04:25:18 +0800
commit56125431cbc3b0a2a2b319bb692a7adbce35cbd8 (patch)
tree8b31a511e3ec58eae5cb5d80e8347d399c550e6d /SolidityCompiler.cpp
parentf7f26d0fbd6f8ba1f00a547dd243f4394e3b524c (diff)
parent69fa5db47144dbe4f1272d29fe75149262671d5f (diff)
downloaddexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar.gz
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar.bz2
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar.lz
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar.xz
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.tar.zst
dexon-solidity-56125431cbc3b0a2a2b319bb692a7adbce35cbd8.zip
Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into develop
Diffstat (limited to 'SolidityCompiler.cpp')
-rw-r--r--SolidityCompiler.cpp61
1 files changed, 5 insertions, 56 deletions
diff --git a/SolidityCompiler.cpp b/SolidityCompiler.cpp
index 53daa9df..17d9a7c0 100644
--- a/SolidityCompiler.cpp
+++ b/SolidityCompiler.cpp
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
"}\n";
bytes code = compileContract(sourceCode);
- unsigned boilerplateSize = 73;
+ unsigned boilerplateSize = 69;
bytes expectation({byte(Instruction::JUMPDEST),
byte(Instruction::PUSH1), 0x0, // initialize local variable x
byte(Instruction::PUSH1), 0x2,
@@ -108,65 +108,14 @@ BOOST_AUTO_TEST_CASE(smoke_test)
checkCodePresentAt(code, expectation, boilerplateSize);
}
-BOOST_AUTO_TEST_CASE(different_argument_numbers)
-{
- char const* sourceCode = "contract test {\n"
- " function f(uint a, uint b, uint c) returns(uint d) { return b; }\n"
- " function g() returns (uint e, uint h) { h = f(1, 2, 3); }\n"
- "}\n";
- bytes code = compileContract(sourceCode);
- unsigned shift = 103;
- unsigned boilerplateSize = 116;
- bytes expectation({byte(Instruction::JUMPDEST),
- byte(Instruction::PUSH1), 0x0, // initialize return variable d
- byte(Instruction::DUP3),
- byte(Instruction::SWAP1), // assign b to d
- byte(Instruction::POP),
- byte(Instruction::PUSH1), byte(0xa + shift), // jump to return
- byte(Instruction::JUMP),
- byte(Instruction::JUMPDEST),
- byte(Instruction::SWAP4), // store d and fetch return address
- byte(Instruction::SWAP3), // store return address
- byte(Instruction::POP),
- byte(Instruction::POP),
- byte(Instruction::POP),
- byte(Instruction::JUMP), // end of f
- byte(Instruction::JUMPDEST), // beginning of g
- byte(Instruction::PUSH1), 0x0,
- byte(Instruction::PUSH1), 0x0, // initialized e and h
- byte(Instruction::PUSH1), byte(0x21 + shift), // ret address
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::PUSH1), 0x2,
- byte(Instruction::PUSH1), 0x3,
- byte(Instruction::PUSH1), byte(0x1 + shift),
- // stack here: ret e h 0x20 1 2 3 0x1
- byte(Instruction::JUMP),
- byte(Instruction::JUMPDEST),
- // stack here: ret e h f(1,2,3)
- byte(Instruction::SWAP1),
- // stack here: ret e f(1,2,3) h
- byte(Instruction::POP),
- byte(Instruction::DUP1), // retrieve it again as "value of expression"
- byte(Instruction::POP), // end of assignment
- // stack here: ret e f(1,2,3)
- byte(Instruction::JUMPDEST),
- byte(Instruction::SWAP1),
- // ret e f(1,2,3)
- byte(Instruction::SWAP2),
- // f(1,2,3) e ret
- byte(Instruction::JUMP) // end of g
- });
- checkCodePresentAt(code, expectation, boilerplateSize);
-}
-
BOOST_AUTO_TEST_CASE(ifStatement)
{
char const* sourceCode = "contract test {\n"
" function f() { bool x; if (x) 77; else if (!x) 78; else 79; }"
"}\n";
bytes code = compileContract(sourceCode);
- unsigned shift = 60;
- unsigned boilerplateSize = 73;
+ unsigned shift = 56;
+ unsigned boilerplateSize = 69;
bytes expectation({byte(Instruction::JUMPDEST),
byte(Instruction::PUSH1), 0x0,
byte(Instruction::DUP1),
@@ -206,8 +155,8 @@ BOOST_AUTO_TEST_CASE(loops)
" function f() { while(true){1;break;2;continue;3;return;4;} }"
"}\n";
bytes code = compileContract(sourceCode);
- unsigned shift = 60;
- unsigned boilerplateSize = 73;
+ unsigned shift = 56;
+ unsigned boilerplateSize = 69;
bytes expectation({byte(Instruction::JUMPDEST),
byte(Instruction::JUMPDEST),
byte(Instruction::PUSH1), 0x1,