mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
WIP-3
This commit is contained in:
+19
-1
@@ -171,7 +171,7 @@ public:
|
||||
SourceUnitAnnotation& annotation() const override;
|
||||
|
||||
std::optional<std::string> const& licenseString() const { return m_licenseString; }
|
||||
std::vector<ASTPointer<ASTNode>> nodes() const { return m_nodes; }
|
||||
std::vector<ASTPointer<ASTNode>> const& nodes() const { return m_nodes; }
|
||||
|
||||
/// Replaces given top-level AST node with a new AST node.
|
||||
void replaceNode(ASTPointer<ASTNode> _oldNode, ASTPointer<ASTNode> _newNode);
|
||||
@@ -453,6 +453,24 @@ protected:
|
||||
|
||||
/// @}
|
||||
|
||||
class ImportedContractDefinition: public Declaration
|
||||
{
|
||||
public:
|
||||
ImportedContractDefinition(
|
||||
int64_t _id,
|
||||
SourceLocation const& _location,
|
||||
ASTPointer<ASTString> const& _name,
|
||||
ASTPointer<ASTString> const& _path
|
||||
);
|
||||
|
||||
void accept(ASTVisitor& _visitor) override;
|
||||
void accept(ASTConstVisitor& _visitor) const override;
|
||||
|
||||
private:
|
||||
ASTPointer<ASTString> m_name;
|
||||
ASTPointer<ASTString> m_path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Definition of a contract or library. This is the only AST nodes where child nodes are not visited in
|
||||
* document order. It first visits all struct declarations, then all variable declarations and
|
||||
|
||||
@@ -278,9 +278,12 @@ void CompilerStack::loadMissingInterfaces()
|
||||
{
|
||||
for (auto const& sourcePair: m_sources)
|
||||
{
|
||||
ASTPointer<SourceUnit> const& source = sourcePair.second.ast;;
|
||||
ASTPointer<SourceUnit> const& source = sourcePair.second.ast;
|
||||
if (!source)
|
||||
// This can happen if the input source code contained invalid source code.
|
||||
continue;
|
||||
|
||||
for (auto const& astNode: source->nodes())
|
||||
for (ASTPointer<ASTNode> const& astNode: source->nodes())
|
||||
{
|
||||
if (auto* contract = dynamic_cast<ContractDefinition*>(astNode.get()))
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective()
|
||||
fatalParserError(9478_error, "Expected string literal (path), \"*\" or alias list.");
|
||||
// "from" is not a keyword but parsed as an identifier because of backwards
|
||||
// compatibility and because it is a really common word.
|
||||
if (m_scanner->currentToken() != Token::Identifier || m_scanner->currentLiteral() != "from")
|
||||
if (!m_scanner->isIdentifier("from"))
|
||||
fatalParserError(8208_error, "Expected \"from\".");
|
||||
m_scanner->next();
|
||||
if (m_scanner->currentToken() != Token::StringLiteral)
|
||||
@@ -307,7 +307,7 @@ ASTPointer<ContractDefinition> Parser::parseInterfaceDefinition()
|
||||
ASTPointer<StructuredDocumentation> documentation = parseStructuredDocumentation();
|
||||
vector<ASTPointer<InheritanceSpecifier>> baseContracts;
|
||||
|
||||
if (m_scanner->currentToken() == Token::From)
|
||||
if (m_scanner->isIdentifier("from"))
|
||||
{
|
||||
m_scanner->next();
|
||||
if (m_scanner->currentToken() != Token::StringLiteral)
|
||||
|
||||
Reference in New Issue
Block a user