mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Modify parser and optimizer.
This commit is contained in:
@@ -70,6 +70,8 @@ class TerminationFinder
|
||||
public:
|
||||
enum class ControlFlow { FlowOut, Break, Continue, Terminate };
|
||||
|
||||
TerminationFinder(Dialect const& _dialect): m_dialect(_dialect) {}
|
||||
|
||||
/// @returns the index of the first statement in the provided sequence
|
||||
/// that is an unconditional ``break``, ``continue`` or a
|
||||
/// call to a terminating builtin function.
|
||||
@@ -77,18 +79,21 @@ public:
|
||||
/// returns `FlowOut` and ``size_t(-1)``.
|
||||
/// The function might return ``FlowOut`` even though control
|
||||
/// flow cannot actually continue.
|
||||
static std::pair<ControlFlow, size_t> firstUnconditionalControlFlowChange(
|
||||
std::pair<ControlFlow, size_t> firstUnconditionalControlFlowChange(
|
||||
std::vector<Statement> const& _statements
|
||||
);
|
||||
|
||||
/// @returns the control flow type of the given statement.
|
||||
/// This function could return FlowOut even if control flow never continues.
|
||||
static ControlFlow controlFlowKind(Statement const& _statement);
|
||||
ControlFlow controlFlowKind(Statement const& _statement);
|
||||
|
||||
/// @returns true if the expression statement is a direct
|
||||
/// call to a builtin terminating function like
|
||||
/// ``stop``, ``revert`` or ``return``.
|
||||
static bool isTerminatingBuiltin(ExpressionStatement const& _exprStmnt);
|
||||
bool isTerminatingBuiltin(ExpressionStatement const& _exprStmnt);
|
||||
|
||||
private:
|
||||
Dialect const& m_dialect;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user