mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removing extra default cases to force compile time error, instead of runtime.
This commit is contained in:
parent
b86cea033b
commit
3321000f67
@ -311,8 +311,6 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
|
|||||||
return make_shared<FunctionType>(*this, _internal);
|
return make_shared<FunctionType>(*this, _internal);
|
||||||
case Declaration::Visibility::External:
|
case Declaration::Visibility::External:
|
||||||
return {};
|
return {};
|
||||||
default:
|
|
||||||
solAssert(false, "visibility() should return a Visibility");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -327,8 +325,6 @@ FunctionTypePointer FunctionDefinition::functionType(bool _internal) const
|
|||||||
case Declaration::Visibility::Public:
|
case Declaration::Visibility::Public:
|
||||||
case Declaration::Visibility::External:
|
case Declaration::Visibility::External:
|
||||||
return make_shared<FunctionType>(*this, _internal);
|
return make_shared<FunctionType>(*this, _internal);
|
||||||
default:
|
|
||||||
solAssert(false, "visibility() should return a Visibility");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,8 +564,6 @@ FunctionTypePointer VariableDeclaration::functionType(bool _internal) const
|
|||||||
case Declaration::Visibility::Public:
|
case Declaration::Visibility::Public:
|
||||||
case Declaration::Visibility::External:
|
case Declaration::Visibility::External:
|
||||||
return make_shared<FunctionType>(*this);
|
return make_shared<FunctionType>(*this);
|
||||||
default:
|
|
||||||
solAssert(false, "visibility() should not return a Visibility");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// To make the compiler happy
|
// To make the compiler happy
|
||||||
|
@ -747,9 +747,9 @@ string ASTJsonConverter::location(VariableDeclaration::Location _location)
|
|||||||
return "memory";
|
return "memory";
|
||||||
case VariableDeclaration::Location::CallData:
|
case VariableDeclaration::Location::CallData:
|
||||||
return "calldata";
|
return "calldata";
|
||||||
default:
|
|
||||||
solAssert(false, "Unknown declaration location.");
|
|
||||||
}
|
}
|
||||||
|
// To make the compiler happy
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
string ASTJsonConverter::contractKind(ContractDefinition::ContractKind _kind)
|
string ASTJsonConverter::contractKind(ContractDefinition::ContractKind _kind)
|
||||||
@ -762,9 +762,10 @@ string ASTJsonConverter::contractKind(ContractDefinition::ContractKind _kind)
|
|||||||
return "contract";
|
return "contract";
|
||||||
case ContractDefinition::ContractKind::Library:
|
case ContractDefinition::ContractKind::Library:
|
||||||
return "library";
|
return "library";
|
||||||
default:
|
|
||||||
solAssert(false, "Unknown kind of contract.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To make the compiler happy
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
string ASTJsonConverter::functionCallKind(FunctionCallKind _kind)
|
string ASTJsonConverter::functionCallKind(FunctionCallKind _kind)
|
||||||
|
@ -1108,8 +1108,6 @@ void ArrayUtils::accessIndex(ArrayType const& _arrayType, bool _doBoundsCheck) c
|
|||||||
m_context << endTag;
|
m_context << endTag;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
solAssert(false, "");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,15 +895,6 @@ void CompilerUtils::convertType(
|
|||||||
typeOnStack.location() == DataLocation::CallData,
|
typeOnStack.location() == DataLocation::CallData,
|
||||||
"Invalid conversion to calldata type.");
|
"Invalid conversion to calldata type.");
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
solAssert(
|
|
||||||
false,
|
|
||||||
"Invalid type conversion " +
|
|
||||||
_typeOnStack.toString(false) +
|
|
||||||
" to " +
|
|
||||||
_targetType.toString(false) +
|
|
||||||
" requested."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -639,8 +639,6 @@ void SMTChecker::checkCondition(
|
|||||||
case smt::CheckResult::ERROR:
|
case smt::CheckResult::ERROR:
|
||||||
m_errorReporter.warning(_location, "Error trying to invoke SMT solver.");
|
m_errorReporter.warning(_location, "Error trying to invoke SMT solver.");
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
solAssert(false, "");
|
|
||||||
}
|
}
|
||||||
m_interface->pop();
|
m_interface->pop();
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,6 @@ pair<CheckResult, vector<string>> Z3Interface::check(vector<Expression> const& _
|
|||||||
case z3::check_result::unknown:
|
case z3::check_result::unknown:
|
||||||
result = CheckResult::UNKNOWN;
|
result = CheckResult::UNKNOWN;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
solAssert(false, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == CheckResult::SATISFIABLE && !_expressionsToEvaluate.empty())
|
if (result == CheckResult::SATISFIABLE && !_expressionsToEvaluate.empty())
|
||||||
|
@ -49,9 +49,6 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip
|
|||||||
case Type::Warning:
|
case Type::Warning:
|
||||||
m_typeName = "Warning";
|
m_typeName = "Warning";
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
solAssert(false, "");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_location.isEmpty())
|
if (!_location.isEmpty())
|
||||||
|
Loading…
Reference in New Issue
Block a user