2017-07-01 09:09:24 +00:00
|
|
|
/*
|
2019-02-13 15:56:46 +00:00
|
|
|
This file is part of solidity.
|
2017-07-01 09:09:24 +00:00
|
|
|
|
2019-02-13 15:56:46 +00:00
|
|
|
solidity is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2017-07-01 09:09:24 +00:00
|
|
|
|
2019-02-13 15:56:46 +00:00
|
|
|
solidity is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2017-07-01 09:09:24 +00:00
|
|
|
|
2019-02-13 15:56:46 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
2017-07-01 09:09:24 +00:00
|
|
|
*/
|
2020-07-17 14:54:12 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0
|
2017-07-01 09:09:24 +00:00
|
|
|
/**
|
|
|
|
* @date 2017
|
|
|
|
* Enums for AST classes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-11-14 13:59:30 +00:00
|
|
|
#include <liblangutil/Exceptions.h>
|
2019-03-19 16:12:21 +00:00
|
|
|
#include <libsolidity/ast/ASTForward.h>
|
2017-07-01 09:09:24 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2019-12-11 16:31:36 +00:00
|
|
|
namespace solidity::frontend
|
2017-07-01 09:09:24 +00:00
|
|
|
{
|
|
|
|
|
2020-09-16 09:00:07 +00:00
|
|
|
/// Possible lookups for function resolving
|
|
|
|
enum class VirtualLookup { Static, Virtual, Super };
|
|
|
|
|
2017-07-01 09:09:24 +00:00
|
|
|
// How a function can mutate the EVM state.
|
2017-08-15 01:26:24 +00:00
|
|
|
enum class StateMutability { Pure, View, NonPayable, Payable };
|
2017-07-01 09:09:24 +00:00
|
|
|
|
2019-12-10 14:54:09 +00:00
|
|
|
/// Visibility ordered from restricted to unrestricted.
|
|
|
|
enum class Visibility { Default, Private, Internal, Public, External };
|
|
|
|
|
2020-07-22 08:28:04 +00:00
|
|
|
enum class Arithmetic { Checked, Wrapping };
|
|
|
|
|
2017-07-01 09:09:24 +00:00
|
|
|
inline std::string stateMutabilityToString(StateMutability const& _stateMutability)
|
|
|
|
{
|
2019-11-11 16:09:59 +00:00
|
|
|
switch (_stateMutability)
|
2017-07-01 09:09:24 +00:00
|
|
|
{
|
2017-08-15 01:26:24 +00:00
|
|
|
case StateMutability::Pure:
|
|
|
|
return "pure";
|
2017-07-01 09:09:24 +00:00
|
|
|
case StateMutability::View:
|
|
|
|
return "view";
|
|
|
|
case StateMutability::NonPayable:
|
|
|
|
return "nonpayable";
|
|
|
|
case StateMutability::Payable:
|
|
|
|
return "payable";
|
|
|
|
default:
|
|
|
|
solAssert(false, "Unknown state mutability.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-19 16:12:21 +00:00
|
|
|
class Type;
|
|
|
|
|
|
|
|
/// Container for function call parameter types & names
|
|
|
|
struct FuncCallArguments
|
|
|
|
{
|
|
|
|
/// Types of arguments
|
2019-04-15 13:33:39 +00:00
|
|
|
std::vector<Type const*> types;
|
2019-03-19 16:12:21 +00:00
|
|
|
/// Names of the arguments if given, otherwise unset
|
|
|
|
std::vector<ASTPointer<ASTString>> names;
|
|
|
|
|
|
|
|
size_t numArguments() const { return types.size(); }
|
|
|
|
size_t numNames() const { return names.size(); }
|
|
|
|
bool hasNamedArguments() const { return !names.empty(); }
|
|
|
|
};
|
|
|
|
|
2020-01-07 14:11:29 +00:00
|
|
|
enum class ContractKind { Interface, Contract, Library };
|
|
|
|
|
2017-07-01 09:09:24 +00:00
|
|
|
}
|