mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add new annotations for Scopables
This commit is contained in:
parent
30b1b39901
commit
69fd185903
@ -660,6 +660,27 @@ InlineAssemblyAnnotation& InlineAssembly::annotation() const
|
|||||||
return dynamic_cast<InlineAssemblyAnnotation&>(*m_annotation);
|
return dynamic_cast<InlineAssemblyAnnotation&>(*m_annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlockAnnotation& Block::annotation() const
|
||||||
|
{
|
||||||
|
if (!m_annotation)
|
||||||
|
m_annotation = make_unique<BlockAnnotation>();
|
||||||
|
return dynamic_cast<BlockAnnotation&>(*m_annotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
TryCatchClauseAnnotation& TryCatchClause::annotation() const
|
||||||
|
{
|
||||||
|
if (!m_annotation)
|
||||||
|
m_annotation = make_unique<TryCatchClauseAnnotation>();
|
||||||
|
return dynamic_cast<TryCatchClauseAnnotation&>(*m_annotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
ForStatementAnnotation& ForStatement::annotation() const
|
||||||
|
{
|
||||||
|
if (!m_annotation)
|
||||||
|
m_annotation = make_unique<ForStatementAnnotation>();
|
||||||
|
return dynamic_cast<ForStatementAnnotation&>(*m_annotation);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnAnnotation& Return::annotation() const
|
ReturnAnnotation& Return::annotation() const
|
||||||
{
|
{
|
||||||
if (!m_annotation)
|
if (!m_annotation)
|
||||||
|
@ -1171,6 +1171,8 @@ public:
|
|||||||
|
|
||||||
std::vector<ASTPointer<Statement>> const& statements() const { return m_statements; }
|
std::vector<ASTPointer<Statement>> const& statements() const { return m_statements; }
|
||||||
|
|
||||||
|
BlockAnnotation& annotation() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ASTPointer<Statement>> m_statements;
|
std::vector<ASTPointer<Statement>> m_statements;
|
||||||
};
|
};
|
||||||
@ -1250,6 +1252,8 @@ public:
|
|||||||
ParameterList const* parameters() const { return m_parameters.get(); }
|
ParameterList const* parameters() const { return m_parameters.get(); }
|
||||||
Block const& block() const { return *m_block; }
|
Block const& block() const { return *m_block; }
|
||||||
|
|
||||||
|
TryCatchClauseAnnotation& annotation() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ASTPointer<ASTString> m_errorName;
|
ASTPointer<ASTString> m_errorName;
|
||||||
ASTPointer<ParameterList> m_parameters;
|
ASTPointer<ParameterList> m_parameters;
|
||||||
@ -1359,6 +1363,8 @@ public:
|
|||||||
ExpressionStatement const* loopExpression() const { return m_loopExpression.get(); }
|
ExpressionStatement const* loopExpression() const { return m_loopExpression.get(); }
|
||||||
Statement const& body() const { return *m_body; }
|
Statement const& body() const { return *m_body; }
|
||||||
|
|
||||||
|
ForStatementAnnotation& annotation() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// For statement's initialization expression. for (XXX; ; ). Can be empty
|
/// For statement's initialization expression. for (XXX; ; ). Can be empty
|
||||||
ASTPointer<Statement> m_initExpression;
|
ASTPointer<Statement> m_initExpression;
|
||||||
|
@ -163,6 +163,18 @@ struct InlineAssemblyAnnotation: StatementAnnotation
|
|||||||
std::shared_ptr<yul::AsmAnalysisInfo> analysisInfo;
|
std::shared_ptr<yul::AsmAnalysisInfo> analysisInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct BlockAnnotation: StatementAnnotation, ScopableAnnotation
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TryCatchClauseAnnotation: ASTAnnotation, ScopableAnnotation
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ForStatementAnnotation: StatementAnnotation, ScopableAnnotation
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct ReturnAnnotation: StatementAnnotation
|
struct ReturnAnnotation: StatementAnnotation
|
||||||
{
|
{
|
||||||
/// Reference to the return parameters of the function.
|
/// Reference to the return parameters of the function.
|
||||||
|
Loading…
Reference in New Issue
Block a user