mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simple aliasing during import.
This commit is contained in:
@@ -111,7 +111,8 @@ private:
|
||||
/// Maps nodes declaring a scope to scopes, i.e. ContractDefinition and FunctionDeclaration,
|
||||
/// where nullptr denotes the global scope. Note that structs are not scope since they do
|
||||
/// not contain code.
|
||||
std::map<ASTNode const*, std::unique_ptr<DeclarationContainer>> m_scopes;
|
||||
/// Aliases (for example `import "x" as y;`) create multiple pointers to the same scope.
|
||||
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>> m_scopes;
|
||||
|
||||
DeclarationContainer* m_currentScope = nullptr;
|
||||
ErrorList& m_errors;
|
||||
@@ -125,12 +126,13 @@ class DeclarationRegistrationHelper: private ASTVisitor
|
||||
{
|
||||
public:
|
||||
DeclarationRegistrationHelper(
|
||||
std::map<ASTNode const*, std::unique_ptr<DeclarationContainer>>& _scopes,
|
||||
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& _scopes,
|
||||
ASTNode& _astRoot,
|
||||
ErrorList& _errors
|
||||
);
|
||||
|
||||
private:
|
||||
bool visit(ImportDirective& _declaration) override;
|
||||
bool visit(ContractDefinition& _contract) override;
|
||||
void endVisit(ContractDefinition& _contract) override;
|
||||
bool visit(StructDefinition& _struct) override;
|
||||
@@ -166,7 +168,7 @@ private:
|
||||
// creates the Declaration error and adds it in the errors list and throws FatalError
|
||||
void fatalDeclarationError(SourceLocation _sourceLocation, std::string const& _description);
|
||||
|
||||
std::map<ASTNode const*, std::unique_ptr<DeclarationContainer>>& m_scopes;
|
||||
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>>& m_scopes;
|
||||
ASTNode const* m_currentScope = nullptr;
|
||||
VariableScope* m_currentFunction = nullptr;
|
||||
ErrorList& m_errors;
|
||||
|
||||
Reference in New Issue
Block a user