aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-18 04:26:10 +0800
committerchriseth <chris@ethereum.org>2018-10-18 04:26:40 +0800
commit97d01d9b47acf6a0383872fab81d27bc75773b48 (patch)
treed4a5b79d14faabab36a8c08b8696a785cfd7c73b /libsolidity/codegen
parent3d1ca07e9b4b42355aa9be5db5c00048607986d1 (diff)
downloaddexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar.gz
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar.bz2
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar.lz
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar.xz
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.tar.zst
dexon-solidity-97d01d9b47acf6a0383872fab81d27bc75773b48.zip
Assert about some removed language concepts in the code generator.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 27440289..749739ce 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -568,12 +568,13 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
case FunctionType::Kind::External:
case FunctionType::Kind::DelegateCall:
case FunctionType::Kind::BareCall:
- case FunctionType::Kind::BareCallCode:
case FunctionType::Kind::BareDelegateCall:
case FunctionType::Kind::BareStaticCall:
_functionCall.expression().accept(*this);
appendExternalFunctionCall(function, arguments);
break;
+ case FunctionType::Kind::BareCallCode:
+ solAssert(false, "Callcode has been removed.");
case FunctionType::Kind::Creation:
{
_functionCall.expression().accept(*this);
@@ -1328,8 +1329,6 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
m_context << Instruction::CALLVALUE;
else if (member == "origin")
m_context << Instruction::ORIGIN;
- else if (member == "gas")
- m_context << Instruction::GAS;
else if (member == "gasprice")
m_context << Instruction::GASPRICE;
else if (member == "data")
@@ -1337,9 +1336,10 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
else if (member == "sig")
m_context << u256(0) << Instruction::CALLDATALOAD
<< (u256(0xffffffff) << (256 - 32)) << Instruction::AND;
+ else if (member == "gas")
+ solAssert(false, "Gas has been removed.");
else if (member == "blockhash")
- {
- }
+ solAssert(false, "Blockhash has been removed.");
else
solAssert(false, "Unknown magic member.");
break;
@@ -1844,8 +1844,9 @@ void ExpressionCompiler::appendExternalFunctionCall(
solAssert(funKind != FunctionType::Kind::BareStaticCall || m_context.evmVersion().hasStaticCall(), "");
- bool returnSuccessConditionAndReturndata = funKind == FunctionType::Kind::BareCall || funKind == FunctionType::Kind::BareCallCode || funKind == FunctionType::Kind::BareDelegateCall || funKind == FunctionType::Kind::BareStaticCall;
- bool isCallCode = funKind == FunctionType::Kind::BareCallCode;
+ solAssert(funKind != FunctionType::Kind::BareCallCode, "Callcode has been removed.");
+
+ bool returnSuccessConditionAndReturndata = funKind == FunctionType::Kind::BareCall || funKind == FunctionType::Kind::BareDelegateCall || funKind == FunctionType::Kind::BareStaticCall;
bool isDelegateCall = funKind == FunctionType::Kind::BareDelegateCall || funKind == FunctionType::Kind::DelegateCall;
bool useStaticCall = funKind == FunctionType::Kind::BareStaticCall || (_functionType.stateMutability() <= StateMutability::View && m_context.evmVersion().hasStaticCall());
@@ -1930,7 +1931,7 @@ void ExpressionCompiler::appendExternalFunctionCall(
parameterTypes,
_functionType.padArguments(),
_functionType.takesArbitraryParameters() || _functionType.isBareCall(),
- isCallCode || isDelegateCall
+ isDelegateCall
);
// Stack now:
@@ -2001,8 +2002,6 @@ void ExpressionCompiler::appendExternalFunctionCall(
// Order is important here, STATICCALL might overlap with DELEGATECALL.
if (isDelegateCall)
m_context << Instruction::DELEGATECALL;
- else if (isCallCode)
- m_context << Instruction::CALLCODE;
else if (useStaticCall)
m_context << Instruction::STATICCALL;
else