mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fixes source location in warning for shadowing import delcarations.
This commit is contained in:
+14
-5
@@ -280,22 +280,31 @@ private:
|
||||
class ImportDirective: public Declaration
|
||||
{
|
||||
public:
|
||||
struct SymbolAlias
|
||||
{
|
||||
ASTPointer<Identifier> symbol;
|
||||
ASTPointer<ASTString> alias;
|
||||
SourceLocation location;
|
||||
};
|
||||
|
||||
using SymbolAliasList = std::vector<SymbolAlias>;
|
||||
|
||||
ImportDirective(
|
||||
SourceLocation const& _location,
|
||||
ASTPointer<ASTString> const& _path,
|
||||
ASTPointer<ASTString> const& _unitAlias,
|
||||
std::vector<std::pair<ASTPointer<Identifier>, ASTPointer<ASTString>>>&& _symbolAliases
|
||||
SymbolAliasList _symbolAliases
|
||||
):
|
||||
Declaration(_location, _unitAlias),
|
||||
m_path(_path),
|
||||
m_symbolAliases(_symbolAliases)
|
||||
m_symbolAliases(move(_symbolAliases))
|
||||
{ }
|
||||
|
||||
void accept(ASTVisitor& _visitor) override;
|
||||
void accept(ASTConstVisitor& _visitor) const override;
|
||||
|
||||
ASTString const& path() const { return *m_path; }
|
||||
std::vector<std::pair<ASTPointer<Identifier>, ASTPointer<ASTString>>> const& symbolAliases() const
|
||||
SymbolAliasList const& symbolAliases() const
|
||||
{
|
||||
return m_symbolAliases;
|
||||
}
|
||||
@@ -306,9 +315,9 @@ public:
|
||||
private:
|
||||
ASTPointer<ASTString> m_path;
|
||||
/// The aliases for the specific symbols to import. If non-empty import the specific symbols.
|
||||
/// If the second component is empty, import the identifier unchanged.
|
||||
/// If the `alias` component is empty, import the identifier unchanged.
|
||||
/// If both m_unitAlias and m_symbolAlias are empty, import all symbols into the current scope.
|
||||
std::vector<std::pair<ASTPointer<Identifier>, ASTPointer<ASTString>>> m_symbolAliases;
|
||||
SymbolAliasList m_symbolAliases;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -243,9 +243,9 @@ bool ASTJsonConverter::visit(ImportDirective const& _node)
|
||||
for (auto const& symbolAlias: _node.symbolAliases())
|
||||
{
|
||||
Json::Value tuple(Json::objectValue);
|
||||
solAssert(symbolAlias.first, "");
|
||||
tuple["foreign"] = nodeId(*symbolAlias.first);
|
||||
tuple["local"] = symbolAlias.second ? Json::Value(*symbolAlias.second) : Json::nullValue;
|
||||
solAssert(symbolAlias.symbol, "");
|
||||
tuple["foreign"] = nodeId(*symbolAlias.symbol);
|
||||
tuple["local"] = symbolAlias.alias ? Json::Value(*symbolAlias.alias) : Json::nullValue;
|
||||
symbolAliases.append(tuple);
|
||||
}
|
||||
attributes.emplace_back("symbolAliases", std::move(symbolAliases));
|
||||
|
||||
Reference in New Issue
Block a user