Merge pull request #9753 from ethereum/issue-9495-2

Allow path syntax for super constructor calls revamped
This commit is contained in:
chriseth 2020-10-13 15:32:57 +02:00 committed by GitHub
commit a4dd24a0aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 542 additions and 451 deletions

View File

@ -5,6 +5,14 @@ Breaking Changes:
* Type System: Disallow explicit conversions from negative literals and literals larger than ``type(uint160).max`` to ``address`` type.
Language Features:
* Super constructors can now be called using the member notation e.g. ``M.C(123)``.
AST Changes:
* New AST Node ``IdentifierPath`` replacing in many places the ``UserDefinedTypeName``
### 0.7.4 (unreleased)
Language Features:

View File

@ -301,7 +301,7 @@ void ContractLevelChecker::checkBaseConstructorArguments(ContractDefinition cons
if (FunctionDefinition const* constructor = contract->constructor())
for (auto const& modifier: constructor->modifiers())
if (auto baseContract = dynamic_cast<ContractDefinition const*>(
modifier->name()->annotation().referencedDeclaration
modifier->name().annotation().referencedDeclaration
))
{
if (modifier->arguments())

View File

@ -290,7 +290,7 @@ bool ControlFlowBuilder::visit(ModifierInvocation const& _modifierInvocation)
appendControlFlow(*argument);
auto modifierDefinition = dynamic_cast<ModifierDefinition const*>(
_modifierInvocation.name()->annotation().referencedDeclaration
_modifierInvocation.name().annotation().referencedDeclaration
);
if (!modifierDefinition) return false;
solAssert(!!modifierDefinition, "");

View File

@ -133,7 +133,7 @@ void DeclarationTypeChecker::endVisit(UserDefinedTypeName const& _typeName)
if (_typeName.annotation().type)
return;
Declaration const* declaration = _typeName.annotation().referencedDeclaration;
Declaration const* declaration = _typeName.pathNode().annotation().referencedDeclaration;
solAssert(declaration, "");
if (StructDefinition const* structDef = dynamic_cast<StructDefinition const*>(declaration))
@ -390,7 +390,6 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable)
}
_variable.annotation().type = type;
}
void DeclarationTypeChecker::endVisit(UsingForDirective const& _usingFor)

View File

@ -122,6 +122,18 @@ bool ImmutableValidator::visit(WhileStatement const& _whileStatement)
return false;
}
void ImmutableValidator::endVisit(IdentifierPath const& _identifierPath)
{
if (auto const callableDef = dynamic_cast<CallableDeclaration const*>(_identifierPath.annotation().referencedDeclaration))
visitCallableIfNew(
*_identifierPath.annotation().requiredLookup == VirtualLookup::Virtual ?
callableDef->resolveVirtual(m_currentContract) :
*callableDef
);
solAssert(!dynamic_cast<VariableDeclaration const*>(_identifierPath.annotation().referencedDeclaration), "");
}
void ImmutableValidator::endVisit(Identifier const& _identifier)
{
if (auto const callableDef = dynamic_cast<CallableDeclaration const*>(_identifier.annotation().referencedDeclaration))

View File

@ -53,6 +53,7 @@ private:
bool visit(MemberAccess const& _memberAccess);
bool visit(IfStatement const& _ifStatement);
bool visit(WhileStatement const& _whileStatement);
void endVisit(IdentifierPath const& _identifierPath);
void endVisit(Identifier const& _identifier);
void endVisit(Return const& _return);

View File

@ -400,7 +400,7 @@ void NameAndTypeResolver::linearizeBaseContracts(ContractDefinition& _contract)
list<list<ContractDefinition const*>> input(1, list<ContractDefinition const*>{});
for (ASTPointer<InheritanceSpecifier> const& baseSpecifier: _contract.baseContracts())
{
UserDefinedTypeName const& baseName = baseSpecifier->name();
IdentifierPath const& baseName = baseSpecifier->name();
auto base = dynamic_cast<ContractDefinition const*>(baseName.annotation().referencedDeclaration);
if (!base)
m_errorReporter.fatalTypeError(8758_error, baseName.location(), "Contract expected.");

View File

@ -154,12 +154,12 @@ vector<ContractDefinition const*> resolveDirectBaseContracts(ContractDefinition
return resolvedContracts;
}
vector<ASTPointer<UserDefinedTypeName>> sortByContract(vector<ASTPointer<UserDefinedTypeName>> const& _list)
vector<ASTPointer<IdentifierPath>> sortByContract(vector<ASTPointer<IdentifierPath>> const& _list)
{
auto sorted = _list;
stable_sort(sorted.begin(), sorted.end(),
[] (ASTPointer<UserDefinedTypeName> _a, ASTPointer<UserDefinedTypeName> _b) {
[] (ASTPointer<IdentifierPath> _a, ASTPointer<IdentifierPath> _b) {
if (!_a || !_b)
return _a < _b;
@ -773,7 +773,7 @@ set<ContractDefinition const*, OverrideChecker::CompareByID> OverrideChecker::re
{
set<ContractDefinition const*, CompareByID> resolved;
for (ASTPointer<UserDefinedTypeName> const& override: _overrides.overrides())
for (ASTPointer<IdentifierPath> const& override: _overrides.overrides())
{
Declaration const* decl = override->annotation().referencedDeclaration;
solAssert(decl, "Expected declaration to be resolved.");
@ -798,7 +798,7 @@ void OverrideChecker::checkOverrideList(OverrideProxy _item, OverrideProxyBySign
if (_item.overrides() && specifiedContracts.size() != _item.overrides()->overrides().size())
{
// Sort by contract id to find duplicate for error reporting
vector<ASTPointer<UserDefinedTypeName>> list =
vector<ASTPointer<IdentifierPath>> list =
sortByContract(_item.overrides()->overrides());
// Find duplicates and output error
@ -818,7 +818,7 @@ void OverrideChecker::checkOverrideList(OverrideProxy _item, OverrideProxyBySign
list[i]->location(),
ssl,
"Duplicate contract \"" +
joinHumanReadable(list[i]->namePath(), ".") +
joinHumanReadable(list[i]->path(), ".") +
"\" found in override list of \"" +
_item.name() +
"\"."

View File

@ -217,9 +217,9 @@ struct OverrideSpecifierChecker: public PostTypeChecker::Checker
void endVisit(OverrideSpecifier const& _overrideSpecifier) override
{
for (ASTPointer<UserDefinedTypeName> const& override: _overrideSpecifier.overrides())
for (ASTPointer<IdentifierPath> const& override: _overrideSpecifier.overrides())
{
Declaration const* decl = override->annotation().referencedDeclaration;
Declaration const* decl = override->annotation().referencedDeclaration;
solAssert(decl, "Expected declaration to be resolved.");
if (dynamic_cast<ContractDefinition const*>(decl))

View File

@ -171,16 +171,16 @@ void ReferencesResolver::endVisit(ModifierDefinition const&)
m_returnParameters.pop_back();
}
void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName)
void ReferencesResolver::endVisit(IdentifierPath const& _path)
{
Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath());
Declaration const* declaration = m_resolver.pathFromCurrentScope(_path.path());
if (!declaration)
{
m_errorReporter.fatalDeclarationError(7920_error, _typeName.location(), "Identifier not found or not unique.");
m_errorReporter.fatalDeclarationError(7920_error, _path.location(), "Identifier not found or not unique.");
return;
}
_typeName.annotation().referencedDeclaration = declaration;
_path.annotation().referencedDeclaration = declaration;
}
bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)

View File

@ -82,7 +82,7 @@ private:
void endVisit(FunctionDefinition const& _functionDefinition) override;
bool visit(ModifierDefinition const& _modifierDefinition) override;
void endVisit(ModifierDefinition const& _modifierDefinition) override;
void endVisit(UserDefinedTypeName const& _typeName) override;
void endVisit(IdentifierPath const& _path) override;
bool visit(InlineAssembly const& _inlineAssembly) override;
bool visit(Return const& _return) override;

View File

@ -351,6 +351,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
if (_function.overrides() && _function.isFree())
m_errorReporter.syntaxError(1750_error, _function.location(), "Free functions cannot override.");
if (!_function.modifiers().empty() && _function.isFree())
m_errorReporter.syntaxError(5811_error, _function.location(), "Free functions cannot have modifiers.");
if (_function.isPayable())
{
if (_function.libraryFunction())
@ -443,7 +446,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
*modifier,
_function.isConstructor() ? baseContracts : vector<ContractDefinition const*>()
);
Declaration const* decl = &dereference(*modifier->name());
Declaration const* decl = &dereference(modifier->name());
if (modifiers.count(decl))
{
if (dynamic_cast<ContractDefinition const*>(decl))
@ -627,9 +630,9 @@ void TypeChecker::visitManually(
for (ASTPointer<Expression> const& argument: arguments)
argument->accept(*this);
_modifier.name()->accept(*this);
_modifier.name().accept(*this);
auto const* declaration = &dereference(*_modifier.name());
auto const* declaration = &dereference(_modifier.name());
vector<ASTPointer<VariableDeclaration>> emptyParameterList;
vector<ASTPointer<VariableDeclaration>> const* parameters = nullptr;
if (auto modifierDecl = dynamic_cast<ModifierDefinition const*>(declaration))
@ -2534,7 +2537,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
if (auto contractName = dynamic_cast<UserDefinedTypeName const*>(&_newExpression.typeName()))
{
auto contract = dynamic_cast<ContractDefinition const*>(&dereference(*contractName));
auto contract = dynamic_cast<ContractDefinition const*>(&dereference(contractName->pathNode()));
if (!contract)
m_errorReporter.fatalTypeError(5540_error, _newExpression.location(), "Identifier is not a contract.");
@ -3196,6 +3199,23 @@ bool TypeChecker::visit(Identifier const& _identifier)
return false;
}
void TypeChecker::endVisit(IdentifierPath const& _identifierPath)
{
if (
dynamic_cast<CallableDeclaration const*>(_identifierPath.annotation().referencedDeclaration) &&
_identifierPath.path().size() == 1
)
_identifierPath.annotation().requiredLookup = VirtualLookup::Virtual;
else
_identifierPath.annotation().requiredLookup = VirtualLookup::Static;
}
void TypeChecker::endVisit(UserDefinedTypeName const& _userDefinedTypeName)
{
if (!_userDefinedTypeName.annotation().type)
_userDefinedTypeName.annotation().type = _userDefinedTypeName.pathNode().annotation().referencedDeclaration->type();
}
void TypeChecker::endVisit(ElementaryTypeNameExpression const& _expr)
{
_expr.annotation().type = TypeProvider::typeType(TypeProvider::fromElementaryTypeName(_expr.type().typeName(), _expr.type().stateMutability()));
@ -3293,10 +3313,10 @@ Declaration const& TypeChecker::dereference(Identifier const& _identifier) const
return *_identifier.annotation().referencedDeclaration;
}
Declaration const& TypeChecker::dereference(UserDefinedTypeName const& _typeName) const
Declaration const& TypeChecker::dereference(IdentifierPath const& _path) const
{
solAssert(!!_typeName.annotation().referencedDeclaration, "Declaration not stored.");
return *_typeName.annotation().referencedDeclaration;
solAssert(!!_path.annotation().referencedDeclaration, "Declaration not stored.");
return *_path.annotation().referencedDeclaration;
}
bool TypeChecker::expectType(Expression const& _expression, Type const& _expectedType)

View File

@ -141,6 +141,8 @@ private:
bool visit(IndexAccess const& _indexAccess) override;
bool visit(IndexRangeAccess const& _indexRangeAccess) override;
bool visit(Identifier const& _identifier) override;
void endVisit(IdentifierPath const& _identifierPath) override;
void endVisit(UserDefinedTypeName const& _userDefinedTypeName) override;
void endVisit(ElementaryTypeNameExpression const& _expr) override;
void endVisit(Literal const& _literal) override;
void endVisit(UsingForDirective const& _usingForDirective) override;
@ -153,7 +155,7 @@ private:
/// @returns the referenced declaration and throws on error.
Declaration const& dereference(Identifier const& _identifier) const;
/// @returns the referenced declaration and throws on error.
Declaration const& dereference(UserDefinedTypeName const& _typeName) const;
Declaration const& dereference(IdentifierPath const& _path) const;
std::vector<Declaration const*> cleanOverloadedDeclarations(
Identifier const& _reference,

View File

@ -432,13 +432,12 @@ void ViewPureChecker::endVisit(IndexRangeAccess const& _indexRangeAccess)
void ViewPureChecker::endVisit(ModifierInvocation const& _modifier)
{
solAssert(_modifier.name(), "");
if (ModifierDefinition const* mod = dynamic_cast<decltype(mod)>(_modifier.name()->annotation().referencedDeclaration))
if (ModifierDefinition const* mod = dynamic_cast<decltype(mod)>(_modifier.name().annotation().referencedDeclaration))
{
MutabilityAndLocation const& mutAndLocation = modifierMutability(*mod);
reportMutability(mutAndLocation.mutability, _modifier.location(), mutAndLocation.location);
}
else
solAssert(dynamic_cast<ContractDefinition const*>(_modifier.name()->annotation().referencedDeclaration), "");
solAssert(dynamic_cast<ContractDefinition const*>(_modifier.name().annotation().referencedDeclaration), "");
}

View File

@ -460,11 +460,6 @@ EventDefinitionAnnotation& EventDefinition::annotation() const
return initAnnotation<EventDefinitionAnnotation>();
}
UserDefinedTypeNameAnnotation& UserDefinedTypeName::annotation() const
{
return initAnnotation<UserDefinedTypeNameAnnotation>();
}
SourceUnit const& Scopable::sourceUnit() const
{
ASTNode const* s = scope();

View File

@ -557,13 +557,34 @@ private:
util::LazyInit<std::vector<EventDefinition const*>> m_interfaceEvents;
};
/**
* A sequence of identifiers separated by dots used outside the expression context. Inside the expression context, this is a sequence of Identifier and MemberAccess.
*/
class IdentifierPath: public ASTNode
{
public:
IdentifierPath(int64_t _id, SourceLocation const& _location, std::vector<ASTString> _path):
ASTNode(_id, _location), m_path(std::move(_path)) {}
std::vector<ASTString> const& path() const { return m_path; }
IdentifierPathAnnotation& annotation() const override
{
return initAnnotation<IdentifierPathAnnotation>();
}
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
private:
std::vector<ASTString> m_path;
};
class InheritanceSpecifier: public ASTNode
{
public:
InheritanceSpecifier(
int64_t _id,
SourceLocation const& _location,
ASTPointer<UserDefinedTypeName> _baseName,
ASTPointer<IdentifierPath> _baseName,
std::unique_ptr<std::vector<ASTPointer<Expression>>> _arguments
):
ASTNode(_id, _location), m_baseName(std::move(_baseName)), m_arguments(std::move(_arguments))
@ -574,14 +595,14 @@ public:
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
UserDefinedTypeName const& name() const { return *m_baseName; }
IdentifierPath const& name() const { return *m_baseName; }
// Returns nullptr if no argument list was given (``C``).
// If an argument list is given (``C(...)``), the arguments are returned
// as a vector of expressions. Note that this vector can be empty (``C()``).
std::vector<ASTPointer<Expression>> const* arguments() const { return m_arguments.get(); }
private:
ASTPointer<UserDefinedTypeName> m_baseName;
ASTPointer<IdentifierPath> m_baseName;
std::unique_ptr<std::vector<ASTPointer<Expression>>> m_arguments;
};
@ -596,7 +617,7 @@ public:
UsingForDirective(
int64_t _id,
SourceLocation const& _location,
ASTPointer<UserDefinedTypeName> _libraryName,
ASTPointer<IdentifierPath> _libraryName,
ASTPointer<TypeName> _typeName
):
ASTNode(_id, _location), m_libraryName(std::move(_libraryName)), m_typeName(std::move(_typeName))
@ -607,12 +628,12 @@ public:
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
UserDefinedTypeName const& libraryName() const { return *m_libraryName; }
IdentifierPath const& libraryName() const { return *m_libraryName; }
/// @returns the type name the library is attached to, null for `*`.
TypeName const* typeName() const { return m_typeName.get(); }
private:
ASTPointer<UserDefinedTypeName> m_libraryName;
ASTPointer<IdentifierPath> m_libraryName;
ASTPointer<TypeName> m_typeName;
};
@ -771,7 +792,7 @@ public:
OverrideSpecifier(
int64_t _id,
SourceLocation const& _location,
std::vector<ASTPointer<UserDefinedTypeName>> _overrides
std::vector<ASTPointer<IdentifierPath>> _overrides
):
ASTNode(_id, _location),
m_overrides(std::move(_overrides))
@ -782,10 +803,10 @@ public:
void accept(ASTConstVisitor& _visitor) const override;
/// @returns the list of specific overrides, if any
std::vector<ASTPointer<UserDefinedTypeName>> const& overrides() const { return m_overrides; }
std::vector<ASTPointer<IdentifierPath>> const& overrides() const { return m_overrides; }
protected:
std::vector<ASTPointer<UserDefinedTypeName>> m_overrides;
std::vector<ASTPointer<IdentifierPath>> m_overrides;
};
class FunctionDefinition: public CallableDeclaration, public StructurallyDocumented, public ImplementationOptional, public ScopeOpener
@ -1056,7 +1077,7 @@ public:
ModifierInvocation(
int64_t _id,
SourceLocation const& _location,
ASTPointer<Identifier> _name,
ASTPointer<IdentifierPath> _name,
std::unique_ptr<std::vector<ASTPointer<Expression>>> _arguments
):
ASTNode(_id, _location), m_modifierName(std::move(_name)), m_arguments(std::move(_arguments))
@ -1067,14 +1088,14 @@ public:
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
ASTPointer<Identifier> const& name() const { return m_modifierName; }
IdentifierPath& name() const { return *m_modifierName; }
// Returns nullptr if no argument list was given (``mod``).
// If an argument list is given (``mod(...)``), the arguments are returned
// as a vector of expressions. Note that this vector can be empty (``mod()``).
std::vector<ASTPointer<Expression>> const* arguments() const { return m_arguments.get(); }
private:
ASTPointer<Identifier> m_modifierName;
ASTPointer<IdentifierPath> m_modifierName;
std::unique_ptr<std::vector<ASTPointer<Expression>>> m_arguments;
};
@ -1203,18 +1224,19 @@ private:
class UserDefinedTypeName: public TypeName
{
public:
UserDefinedTypeName(int64_t _id, SourceLocation const& _location, std::vector<ASTString> _namePath):
TypeName(_id, _location), m_namePath(std::move(_namePath)) {}
UserDefinedTypeName(int64_t _id, SourceLocation const& _location, ASTPointer<IdentifierPath> _namePath):
TypeName(_id, _location), m_namePath(std::move(_namePath))
{
solAssert(m_namePath != nullptr, "Name cannot be null.");
}
void accept(ASTVisitor& _visitor) override;
void accept(ASTConstVisitor& _visitor) const override;
std::vector<ASTString> const& namePath() const { return m_namePath; }
UserDefinedTypeNameAnnotation& annotation() const override;
std::vector<ASTString> const& namePath() const { return m_namePath->path(); }
IdentifierPath& pathNode() const { return *m_namePath; }
private:
std::vector<ASTString> m_namePath;
ASTPointer<IdentifierPath> m_namePath;
};
/**

View File

@ -233,10 +233,12 @@ struct TypeNameAnnotation: ASTAnnotation
TypePointer type = nullptr;
};
struct UserDefinedTypeNameAnnotation: TypeNameAnnotation
struct IdentifierPathAnnotation: ASTAnnotation
{
/// Referenced declaration, set during reference resolution stage.
Declaration const* referencedDeclaration = nullptr;
/// What kind of lookup needs to be done (static, virtual, super) find the declaration.
SetOnce<VirtualLookup> requiredLookup;
};
struct ExpressionAnnotation: ASTAnnotation

View File

@ -326,6 +326,15 @@ bool ASTJsonConverter::visit(ContractDefinition const& _node)
return false;
}
bool ASTJsonConverter::visit(IdentifierPath const& _node)
{
setJsonNode(_node, "IdentifierPath", {
make_pair("name", namePathToString(_node.path())),
make_pair("referencedDeclaration", idOrNull(_node.annotation().referencedDeclaration))
});
return false;
}
bool ASTJsonConverter::visit(InheritanceSpecifier const& _node)
{
setJsonNode(_node, "InheritanceSpecifier", {
@ -484,7 +493,7 @@ bool ASTJsonConverter::visit(ModifierDefinition const& _node)
bool ASTJsonConverter::visit(ModifierInvocation const& _node)
{
setJsonNode(_node, "ModifierInvocation", {
make_pair("modifierName", toJson(*_node.name())),
make_pair("modifierName", toJson(_node.name())),
make_pair("arguments", _node.arguments() ? toJson(*_node.arguments()) : Json::nullValue)
});
return false;
@ -519,8 +528,8 @@ bool ASTJsonConverter::visit(ElementaryTypeName const& _node)
bool ASTJsonConverter::visit(UserDefinedTypeName const& _node)
{
setJsonNode(_node, "UserDefinedTypeName", {
make_pair("name", namePathToString(_node.namePath())),
make_pair("referencedDeclaration", idOrNull(_node.annotation().referencedDeclaration)),
make_pair("pathNode", toJson(_node.pathNode())),
make_pair("referencedDeclaration", idOrNull(_node.pathNode().annotation().referencedDeclaration)),
make_pair("typeDescriptions", typePointerToJson(_node.annotation().type, true))
});
return false;

View File

@ -77,6 +77,7 @@ public:
bool visit(PragmaDirective const& _node) override;
bool visit(ImportDirective const& _node) override;
bool visit(ContractDefinition const& _node) override;
bool visit(IdentifierPath const& _node) override;
bool visit(InheritanceSpecifier const& _node) override;
bool visit(UsingForDirective const& _node) override;
bool visit(StructDefinition const& _node) override;

View File

@ -115,6 +115,8 @@ ASTPointer<ASTNode> ASTJsonImporter::convertJsonToASTNode(Json::Value const& _js
return createImportDirective(_json);
if (nodeType == "ContractDefinition")
return createContractDefinition(_json);
if (nodeType == "IdentifierPath")
return createIdentifierPath(_json);
if (nodeType == "InheritanceSpecifier")
return createInheritanceSpecifier(_json);
if (nodeType == "UsingForDirective")
@ -299,6 +301,23 @@ ASTPointer<ContractDefinition> ASTJsonImporter::createContractDefinition(Json::V
);
}
ASTPointer<IdentifierPath> ASTJsonImporter::createIdentifierPath(Json::Value const& _node)
{
astAssert(_node["name"].isString(), "Expected 'name' to be a string!");
vector<ASTString> namePath;
vector<string> strs;
string nameString = member(_node, "name").asString();
boost::algorithm::split(strs, nameString, boost::is_any_of("."));
astAssert(!strs.empty(), "Expected at least one element in IdentifierPath.");
for (string s: strs)
{
astAssert(!s.empty(), "Expected non-empty string for IdentifierPath element.");
namePath.emplace_back(s);
}
return createASTNode<IdentifierPath>(_node, namePath);
}
ASTPointer<InheritanceSpecifier> ASTJsonImporter::createInheritanceSpecifier(Json::Value const& _node)
{
std::vector<ASTPointer<Expression>> arguments;
@ -306,7 +325,7 @@ ASTPointer<InheritanceSpecifier> ASTJsonImporter::createInheritanceSpecifier(Jso
arguments.push_back(convertJsonToASTNode<Expression>(arg));
return createASTNode<InheritanceSpecifier>(
_node,
createUserDefinedTypeName(member(_node, "baseName")),
createIdentifierPath(member(_node, "baseName")),
member(_node, "arguments").isNull() ? nullptr : make_unique<std::vector<ASTPointer<Expression>>>(arguments)
);
}
@ -315,7 +334,7 @@ ASTPointer<UsingForDirective> ASTJsonImporter::createUsingForDirective(Json::Val
{
return createASTNode<UsingForDirective>(
_node,
createUserDefinedTypeName(member(_node, "libraryName")),
createIdentifierPath(member(_node, "libraryName")),
_node["typeName"].isNull() ? nullptr : convertJsonToASTNode<TypeName>(_node["typeName"])
);
}
@ -365,10 +384,10 @@ ASTPointer<ParameterList> ASTJsonImporter::createParameterList(Json::Value const
ASTPointer<OverrideSpecifier> ASTJsonImporter::createOverrideSpecifier(Json::Value const& _node)
{
std::vector<ASTPointer<UserDefinedTypeName>> overrides;
std::vector<ASTPointer<IdentifierPath>> overrides;
for (auto& param: _node["overrides"])
overrides.push_back(createUserDefinedTypeName(param));
overrides.push_back(createIdentifierPath(param));
return createASTNode<OverrideSpecifier>(
_node,
@ -481,7 +500,7 @@ ASTPointer<ModifierInvocation> ASTJsonImporter::createModifierInvocation(Json::V
arguments.push_back(convertJsonToASTNode<Expression>(arg));
return createASTNode<ModifierInvocation>(
_node,
createIdentifier(member(_node, "modifierName")),
createIdentifierPath(member(_node, "modifierName")),
member(_node, "arguments").isNull() ? nullptr : make_unique<std::vector<ASTPointer<Expression>>>(arguments)
);
}
@ -518,17 +537,9 @@ ASTPointer<ElementaryTypeName> ASTJsonImporter::createElementaryTypeName(Json::V
ASTPointer<UserDefinedTypeName> ASTJsonImporter::createUserDefinedTypeName(Json::Value const& _node)
{
astAssert(_node["name"].isString(), "Expected 'name' to be a string!");
vector<ASTString> namePath;
vector<string> strs;
string nameString = member(_node, "name").asString();
boost::algorithm::split(strs, nameString, boost::is_any_of("."));
for (string s: strs)
namePath.emplace_back(s);
return createASTNode<UserDefinedTypeName>(
_node,
namePath
createIdentifierPath(member(_node, "pathNode"))
);
}

View File

@ -74,6 +74,7 @@ private:
ASTPointer<PragmaDirective> createPragmaDirective(Json::Value const& _node);
ASTPointer<ImportDirective> createImportDirective(Json::Value const& _node);
ASTPointer<ContractDefinition> createContractDefinition(Json::Value const& _node);
ASTPointer<IdentifierPath> createIdentifierPath(Json::Value const& _node);
ASTPointer<InheritanceSpecifier> createInheritanceSpecifier(Json::Value const& _node);
ASTPointer<UsingForDirective> createUsingForDirective(Json::Value const& _node);
ASTPointer<ASTNode> createStructDefinition(Json::Value const& _node);

View File

@ -58,6 +58,7 @@ public:
virtual bool visit(PragmaDirective& _node) { return visitNode(_node); }
virtual bool visit(ImportDirective& _node) { return visitNode(_node); }
virtual bool visit(ContractDefinition& _node) { return visitNode(_node); }
virtual bool visit(IdentifierPath& _node) { return visitNode(_node); }
virtual bool visit(InheritanceSpecifier& _node) { return visitNode(_node); }
virtual bool visit(UsingForDirective& _node) { return visitNode(_node); }
virtual bool visit(StructDefinition& _node) { return visitNode(_node); }
@ -110,6 +111,7 @@ public:
virtual void endVisit(PragmaDirective& _node) { endVisitNode(_node); }
virtual void endVisit(ImportDirective& _node) { endVisitNode(_node); }
virtual void endVisit(ContractDefinition& _node) { endVisitNode(_node); }
virtual void endVisit(IdentifierPath& _node) { endVisitNode(_node); }
virtual void endVisit(InheritanceSpecifier& _node) { endVisitNode(_node); }
virtual void endVisit(UsingForDirective& _node) { endVisitNode(_node); }
virtual void endVisit(StructDefinition& _node) { endVisitNode(_node); }
@ -184,6 +186,7 @@ public:
virtual bool visit(PragmaDirective const& _node) { return visitNode(_node); }
virtual bool visit(ImportDirective const& _node) { return visitNode(_node); }
virtual bool visit(ContractDefinition const& _node) { return visitNode(_node); }
virtual bool visit(IdentifierPath const& _node) { return visitNode(_node); }
virtual bool visit(InheritanceSpecifier const& _node) { return visitNode(_node); }
virtual bool visit(StructDefinition const& _node) { return visitNode(_node); }
virtual bool visit(UsingForDirective const& _node) { return visitNode(_node); }
@ -236,6 +239,7 @@ public:
virtual void endVisit(PragmaDirective const& _node) { endVisitNode(_node); }
virtual void endVisit(ImportDirective const& _node) { endVisitNode(_node); }
virtual void endVisit(ContractDefinition const& _node) { endVisitNode(_node); }
virtual void endVisit(IdentifierPath const& _node) { endVisitNode(_node); }
virtual void endVisit(InheritanceSpecifier const& _node) { endVisitNode(_node); }
virtual void endVisit(UsingForDirective const& _node) { endVisitNode(_node); }
virtual void endVisit(StructDefinition const& _node) { endVisitNode(_node); }

View File

@ -104,6 +104,18 @@ void ContractDefinition::accept(ASTConstVisitor& _visitor) const
_visitor.endVisit(*this);
}
void IdentifierPath::accept(ASTVisitor& _visitor)
{
_visitor.visit(*this);
_visitor.endVisit(*this);
}
void IdentifierPath::accept(ASTConstVisitor& _visitor) const
{
_visitor.visit(*this);
_visitor.endVisit(*this);
}
void InheritanceSpecifier::accept(ASTVisitor& _visitor)
{
if (_visitor.visit(*this))
@ -368,13 +380,15 @@ void ElementaryTypeName::accept(ASTConstVisitor& _visitor) const
void UserDefinedTypeName::accept(ASTVisitor& _visitor)
{
_visitor.visit(*this);
if (_visitor.visit(*this))
this->pathNode().accept(_visitor);
_visitor.endVisit(*this);
}
void UserDefinedTypeName::accept(ASTConstVisitor& _visitor) const
{
_visitor.visit(*this);
if (_visitor.visit(*this))
this->pathNode().accept(_visitor);
_visitor.endVisit(*this);
}

View File

@ -1293,14 +1293,14 @@ void ContractCompiler::appendModifierOrFunctionCode()
ASTPointer<ModifierInvocation> const& modifierInvocation = m_currentFunction->modifiers()[m_modifierDepth];
// constructor call should be excluded
if (dynamic_cast<ContractDefinition const*>(modifierInvocation->name()->annotation().referencedDeclaration))
if (dynamic_cast<ContractDefinition const*>(modifierInvocation->name().annotation().referencedDeclaration))
appendModifierOrFunctionCode();
else
{
solAssert(*modifierInvocation->name()->annotation().requiredLookup == VirtualLookup::Virtual, "");
solAssert(*modifierInvocation->name().annotation().requiredLookup == VirtualLookup::Virtual, "");
ModifierDefinition const& modifier = dynamic_cast<ModifierDefinition const&>(
*modifierInvocation->name()->annotation().referencedDeclaration
*modifierInvocation->name().annotation().referencedDeclaration
).resolveVirtual(m_context.mostDerivedContract());
CompilerContext::LocationSetter locationSetter(m_context, modifier);
std::vector<ASTPointer<Expression>> const& modifierArguments =

View File

@ -444,7 +444,7 @@ pair<string, map<ContractDefinition const*, vector<string>>> IRGenerator::evalua
if (FunctionDefinition const* constructor = _contract.constructor())
for (ASTPointer<ModifierInvocation> const& modifier: constructor->modifiers())
if (auto const* baseContract = dynamic_cast<ContractDefinition const*>(
modifier->name()->annotation().referencedDeclaration
modifier->name().annotation().referencedDeclaration
))
if (
FunctionDefinition const* baseConstructor = baseContract->constructor();

View File

@ -58,7 +58,7 @@ bool SMTEncoder::visit(ContractDefinition const& _contract)
if (auto const& constructor = base->constructor())
for (auto const& invocation: constructor->modifiers())
{
auto refDecl = invocation->name()->annotation().referencedDeclaration;
auto refDecl = invocation->name().annotation().referencedDeclaration;
if (auto const& baseContract = dynamic_cast<ContractDefinition const*>(refDecl))
{
solAssert(!m_baseConstructorCalls.count(baseContract), "");
@ -164,7 +164,7 @@ void SMTEncoder::visitFunctionOrModifier()
ASTPointer<ModifierInvocation> const& modifierInvocation =
function.modifiers()[static_cast<size_t>(m_modifierDepthStack.back())];
solAssert(modifierInvocation, "");
auto refDecl = modifierInvocation->name()->annotation().referencedDeclaration;
auto refDecl = modifierInvocation->name().annotation().referencedDeclaration;
if (dynamic_cast<ContractDefinition const*>(refDecl))
visitFunctionOrModifier();
else if (auto modifierDef = dynamic_cast<ModifierDefinition const*>(refDecl))

View File

@ -83,7 +83,7 @@ void VariableUsage::endVisit(FunctionDefinition const&)
void VariableUsage::endVisit(ModifierInvocation const& _modifierInv)
{
auto const& modifierDef = dynamic_cast<ModifierDefinition const*>(_modifierInv.name()->annotation().referencedDeclaration);
auto const& modifierDef = dynamic_cast<ModifierDefinition const*>(_modifierInv.name().annotation().referencedDeclaration);
if (modifierDef)
modifierDef->accept(*this);
}

View File

@ -389,7 +389,7 @@ ASTPointer<InheritanceSpecifier> Parser::parseInheritanceSpecifier()
{
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
ASTPointer<UserDefinedTypeName> name(parseUserDefinedTypeName());
ASTPointer<IdentifierPath> name(parseIdentifierPath());
unique_ptr<vector<ASTPointer<Expression>>> arguments;
if (m_scanner->currentToken() == Token::LParen)
{
@ -433,7 +433,7 @@ ASTPointer<OverrideSpecifier> Parser::parseOverrideSpecifier()
solAssert(m_scanner->currentToken() == Token::Override, "");
ASTNodeFactory nodeFactory(*this);
std::vector<ASTPointer<UserDefinedTypeName>> overrides;
std::vector<ASTPointer<IdentifierPath>> overrides;
nodeFactory.markEndPosition();
m_scanner->next();
@ -443,7 +443,7 @@ ASTPointer<OverrideSpecifier> Parser::parseOverrideSpecifier()
m_scanner->next();
while (true)
{
overrides.push_back(parseUserDefinedTypeName());
overrides.push_back(parseIdentifierPath());
if (m_scanner->currentToken() == Token::RParen)
break;
@ -900,7 +900,7 @@ ASTPointer<UsingForDirective> Parser::parseUsingDirective()
ASTNodeFactory nodeFactory(*this);
expectToken(Token::Using);
ASTPointer<UserDefinedTypeName> library(parseUserDefinedTypeName());
ASTPointer<IdentifierPath> library(parseIdentifierPath());
ASTPointer<TypeName> typeName;
expectToken(Token::For);
if (m_scanner->currentToken() == Token::Mul)
@ -916,7 +916,7 @@ ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
{
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
ASTPointer<Identifier> name(parseIdentifier());
ASTPointer<IdentifierPath> name(parseIdentifierPath());
unique_ptr<vector<ASTPointer<Expression>>> arguments;
if (m_scanner->currentToken() == Token::LParen)
{
@ -939,6 +939,14 @@ ASTPointer<Identifier> Parser::parseIdentifier()
}
ASTPointer<UserDefinedTypeName> Parser::parseUserDefinedTypeName()
{
ASTNodeFactory nodeFactory(*this);
ASTPointer<IdentifierPath> identifierPath = parseIdentifierPath();
nodeFactory.setEndPositionFromNode(identifierPath);
return nodeFactory.createNode<UserDefinedTypeName>(identifierPath);
}
ASTPointer<IdentifierPath> Parser::parseIdentifierPath()
{
RecursionGuard recursionGuard(*this);
ASTNodeFactory nodeFactory(*this);
@ -950,7 +958,7 @@ ASTPointer<UserDefinedTypeName> Parser::parseUserDefinedTypeName()
nodeFactory.markEndPosition();
identifierPath.push_back(*expectIdentifierToken());
}
return nodeFactory.createNode<UserDefinedTypeName>(identifierPath);
return nodeFactory.createNode<IdentifierPath>(identifierPath);
}
ASTPointer<TypeName> Parser::parseTypeNameSuffix(ASTPointer<TypeName> type, ASTNodeFactory& nodeFactory)
@ -2101,7 +2109,7 @@ ASTPointer<TypeName> Parser::typeNameFromIndexAccessStructure(Parser::IndexAcces
vector<ASTString> path;
for (auto const& el: _iap.path)
path.push_back(dynamic_cast<Identifier const&>(*el).name());
type = nodeFactory.createNode<UserDefinedTypeName>(path);
type = nodeFactory.createNode<UserDefinedTypeName>(nodeFactory.createNode<IdentifierPath>(path));
}
for (auto const& lengthExpression: _iap.indices)
{

View File

@ -106,6 +106,7 @@ private:
ASTPointer<ModifierInvocation> parseModifierInvocation();
ASTPointer<Identifier> parseIdentifier();
ASTPointer<UserDefinedTypeName> parseUserDefinedTypeName();
ASTPointer<IdentifierPath> parseIdentifierPath();
ASTPointer<TypeName> parseTypeNameSuffix(ASTPointer<TypeName> type, ASTNodeFactory& nodeFactory);
ASTPointer<TypeName> parseTypeName();
ASTPointer<FunctionTypeName> parseFunctionType();

View File

@ -34,17 +34,17 @@ Optimized IR:
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "D_13" {
object "D_15" {
code {
{
mstore(64, memoryguard(0x80))
if callvalue() { revert(0, 0) }
let _1 := datasize("D_13_deployed")
codecopy(0, dataoffset("D_13_deployed"), _1)
let _1 := datasize("D_15_deployed")
codecopy(0, dataoffset("D_15_deployed"), _1)
return(0, _1)
}
}
object "D_13_deployed" {
object "D_15_deployed" {
code {
{
let _1 := memoryguard(0x80)

View File

@ -6,17 +6,17 @@ Optimized IR:
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "C_56" {
object "C_59" {
code {
{
mstore(64, memoryguard(0x80))
if callvalue() { revert(0, 0) }
let _1 := datasize("C_56_deployed")
codecopy(0, dataoffset("C_56_deployed"), _1)
let _1 := datasize("C_59_deployed")
codecopy(0, dataoffset("C_59_deployed"), _1)
return(0, _1)
}
}
object "C_56_deployed" {
object "C_59_deployed" {
code {
{
mstore(64, memoryguard(0x80))
@ -48,7 +48,7 @@ object "C_56" {
dst := add(dst, _2)
src := add(src, _2)
}
let ret, ret_1 := fun_sumArray_55(dst_1)
let ret, ret_1 := fun_sumArray_58(dst_1)
let memPos := allocateMemory(_1)
return(memPos, sub(abi_encode_uint256_t_string(memPos, ret, ret_1), memPos))
}
@ -107,15 +107,15 @@ object "C_56" {
{
value := shr(mul(offset, 8), slot_value)
}
function fun_sumArray_55(vloc__s_19_mpos) -> vloc, vloc__24_mpos
function fun_sumArray_58(vloc__s_22_mpos) -> vloc, vloc__27_mpos
{
let _1 := mload(vloc__s_19_mpos)
let _1 := mload(vloc__s_22_mpos)
if iszero(lt(vloc, _1)) { invalid() }
let _2 := mload(mload(add(add(vloc__s_19_mpos, mul(vloc, 32)), 32)))
let _2 := mload(mload(add(add(vloc__s_22_mpos, mul(vloc, 32)), 32)))
let _3, _4 := storage_array_index_access$_t_struct$_S_storage(vloc, vloc)
sstore(_3, _2)
if iszero(lt(0x01, _1)) { invalid() }
let _5 := mload(mload(add(vloc__s_19_mpos, 64)))
let _5 := mload(mload(add(vloc__s_22_mpos, 64)))
if iszero(lt(vloc, 0x02)) { invalid() }
let slot := add(0x02, vloc)
let _6 := sload(slot)
@ -124,7 +124,7 @@ object "C_56" {
sstore(slot, or(and(_6, not(mask)), and(shl(shiftBits, _5), mask)))
let _7, _8 := storage_array_index_access$_t_struct$_S_storage(0x02, vloc)
vloc := extract_from_storage_value_dynamict_uint256(sload(_7), _8)
vloc__24_mpos := convert_t_stringliteral_6490_to_t_string()
vloc__27_mpos := convert_t_stringliteral_6490_to_t_string()
}
function storage_array_index_access$_t_struct$_S_storage(array, index) -> slot, offset
{

View File

@ -1,2 +1,2 @@
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":26,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":29,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":31,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":33,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"},{"astId":27,"contract":"fileA:A","label":"map","offset":0,"slot":"7","type":"t_mapping(t_uint256,t_mapping(t_address,t_bool))"},{"astId":30,"contract":"fileA:A","label":"array","offset":0,"slot":"8","type":"t_array(t_uint256)dyn_storage"},{"astId":32,"contract":"fileA:A","label":"s1","offset":0,"slot":"9","type":"t_string_storage"},{"astId":34,"contract":"fileA:A","label":"b1","offset":0,"slot":"10","type":"t_bytes_storage"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_bool":{"encoding":"inplace","label":"bool","numberOfBytes":"1"},"t_bytes_storage":{"encoding":"bytes","label":"bytes","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"encoding":"mapping","key":"t_address","label":"mapping(address => bool)","numberOfBytes":"32","value":"t_bool"},"t_mapping(t_uint256,t_mapping(t_address,t_bool))":{"encoding":"mapping","key":"t_uint256","label":"mapping(uint256 => mapping(address => bool))","numberOfBytes":"32","value":"t_mapping(t_address,t_bool)"},"t_string_storage":{"encoding":"bytes","label":"string","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}}

View File

@ -1,2 +1,2 @@
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"7","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint256"},{"astId":4,"contract":"fileA:A","label":"b","offset":0,"slot":"1","type":"t_uint256"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"2","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"4","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"160"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}}

View File

@ -1,2 +1,2 @@
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":18,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":20,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
{"contracts":{"fileA":{"A":{"storageLayout":{"storage":[{"astId":14,"contract":"fileA:A","label":"x","offset":0,"slot":"0","type":"t_uint256"},{"astId":16,"contract":"fileA:A","label":"y","offset":0,"slot":"1","type":"t_uint256"},{"astId":19,"contract":"fileA:A","label":"s","offset":0,"slot":"2","type":"t_struct(S)12_storage"},{"astId":21,"contract":"fileA:A","label":"addr","offset":0,"slot":"6","type":"t_address"}],"types":{"t_address":{"encoding":"inplace","label":"address","numberOfBytes":"20"},"t_array(t_uint256)2_storage":{"base":"t_uint256","encoding":"inplace","label":"uint256[2]","numberOfBytes":"64"},"t_array(t_uint256)dyn_storage":{"base":"t_uint256","encoding":"dynamic_array","label":"uint256[]","numberOfBytes":"32"},"t_struct(S)12_storage":{"encoding":"inplace","label":"struct A.S","members":[{"astId":2,"contract":"fileA:A","label":"a","offset":0,"slot":"0","type":"t_uint128"},{"astId":4,"contract":"fileA:A","label":"b","offset":16,"slot":"0","type":"t_uint128"},{"astId":8,"contract":"fileA:A","label":"staticArray","offset":0,"slot":"1","type":"t_array(t_uint256)2_storage"},{"astId":11,"contract":"fileA:A","label":"dynArray","offset":0,"slot":"3","type":"t_array(t_uint256)dyn_storage"}],"numberOfBytes":"128"},"t_uint128":{"encoding":"inplace","label":"uint128","numberOfBytes":"16"},"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"fileA: Warning: Source file does not specify required compiler version!
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"fileA","start":-1},"type":"Warning"}],"sources":{"fileA":{"id":0}}}

View File

@ -4,10 +4,10 @@
{
"C":
[
11
12
]
},
"id": 12,
"id": 13,
"nodeType": "SourceUnit",
"nodes":
[
@ -17,10 +17,10 @@
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 11,
"id": 12,
"linearizedBaseContracts":
[
11
12
],
"name": "C",
"nodeType": "ContractDefinition",
@ -63,17 +63,17 @@
],
"name": "S",
"nodeType": "StructDefinition",
"scope": 11,
"scope": 12,
"src": "17:20:1",
"visibility": "public"
},
{
"constant": false,
"id": 5,
"id": 6,
"mutability": "mutable",
"name": "s",
"nodeType": "VariableDeclaration",
"scope": 11,
"scope": 12,
"src": "42:3:1",
"stateVariable": true,
"storageLocation": "default",
@ -84,9 +84,16 @@
},
"typeName":
{
"id": 4,
"name": "S",
"id": 5,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 4,
"name": "S",
"nodeType": "IdentifierPath",
"referencedDeclaration": 3,
"src": "42:1:1"
},
"referencedDeclaration": 3,
"src": "42:1:1",
"typeDescriptions":
@ -100,7 +107,7 @@
{
"body":
{
"id": 9,
"id": 10,
"nodeType": "Block",
"src": "76:70:1",
"statements":
@ -176,28 +183,28 @@
"externalReferences":
[
{
"declaration": 5,
"declaration": 6,
"isOffset": true,
"isSlot": false,
"src": "106:8:1",
"valueSize": 1
},
{
"declaration": 5,
"declaration": 6,
"isOffset": false,
"isSlot": true,
"src": "128:6:1",
"valueSize": 1
}
],
"id": 8,
"id": 9,
"nodeType": "InlineAssembly",
"src": "86:54:1"
}
]
},
"functionSelector": "ffae15ba",
"id": 10,
"id": 11,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -205,26 +212,26 @@
"nodeType": "FunctionDefinition",
"parameters":
{
"id": 6,
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "61:2:1"
},
"returnParameters":
{
"id": 7,
"id": 8,
"nodeType": "ParameterList",
"parameters": [],
"src": "76:0:1"
},
"scope": 11,
"scope": 12,
"src": "51:95:1",
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
}
],
"scope": 12,
"scope": 13,
"src": "0:148:1"
}
],

View File

@ -6,7 +6,7 @@
{
"C":
[
11
12
]
}
},
@ -28,10 +28,10 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
11
12
],
"name": "C",
"scope": 12
"scope": 13
},
"children":
[
@ -40,7 +40,7 @@
{
"canonicalName": "C.S",
"name": "S",
"scope": 11,
"scope": 12,
"visibility": "public"
},
"children":
@ -85,7 +85,7 @@
"constant": false,
"mutability": "mutable",
"name": "s",
"scope": 11,
"scope": 12,
"stateVariable": true,
"storageLocation": "default",
"type": "struct C.S",
@ -96,16 +96,28 @@
{
"attributes":
{
"name": "S",
"referencedDeclaration": 3,
"type": "struct C.S"
},
"id": 4,
"children":
[
{
"attributes":
{
"name": "S",
"referencedDeclaration": 3
},
"id": 4,
"name": "IdentifierPath",
"src": "42:1:1"
}
],
"id": 5,
"name": "UserDefinedTypeName",
"src": "42:1:1"
}
],
"id": 5,
"id": 6,
"name": "VariableDeclaration",
"src": "42:3:1"
},
@ -121,7 +133,7 @@
null
],
"name": "e",
"scope": 11,
"scope": 12,
"stateMutability": "pure",
"virtual": false,
"visibility": "public"
@ -137,7 +149,7 @@
]
},
"children": [],
"id": 6,
"id": 7,
"name": "ParameterList",
"src": "61:2:1"
},
@ -150,7 +162,7 @@
]
},
"children": [],
"id": 7,
"id": 8,
"name": "ParameterList",
"src": "76:0:1"
},
@ -164,14 +176,14 @@
"externalReferences":
[
{
"declaration": 5,
"declaration": 6,
"isOffset": true,
"isSlot": false,
"src": "106:8:1",
"valueSize": 1
},
{
"declaration": 5,
"declaration": 6,
"isOffset": false,
"isSlot": true,
"src": "128:6:1",
@ -181,27 +193,27 @@
"operations": "{\n let x := s.offset\n let y := mul(s.slot, 2)\n}"
},
"children": [],
"id": 8,
"id": 9,
"name": "InlineAssembly",
"src": "86:54:1"
}
],
"id": 9,
"id": 10,
"name": "Block",
"src": "76:70:1"
}
],
"id": 10,
"id": 11,
"name": "FunctionDefinition",
"src": "51:95:1"
}
],
"id": 11,
"id": 12,
"name": "ContractDefinition",
"src": "0:148:1"
}
],
"id": 12,
"id": 13,
"name": "SourceUnit",
"src": "0:149:1"
}

View File

@ -1,6 +1,6 @@
{
"absolutePath": "a",
"id": 12,
"id": 13,
"nodeType": "SourceUnit",
"nodes":
[
@ -9,7 +9,7 @@
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"id": 11,
"id": 12,
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
@ -46,7 +46,7 @@
},
{
"constant": false,
"id": 5,
"id": 6,
"mutability": "mutable",
"name": "s",
"nodeType": "VariableDeclaration",
@ -56,9 +56,15 @@
"typeDescriptions": {},
"typeName":
{
"id": 4,
"name": "S",
"id": 5,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 4,
"name": "S",
"nodeType": "IdentifierPath",
"src": "42:1:1"
},
"src": "42:1:1",
"typeDescriptions": {}
},
@ -67,7 +73,7 @@
{
"body":
{
"id": 9,
"id": 10,
"nodeType": "Block",
"src": "76:70:1",
"statements":
@ -141,13 +147,13 @@
},
"evmVersion": %EVMVERSION%,
"externalReferences": [],
"id": 8,
"id": 9,
"nodeType": "InlineAssembly",
"src": "86:54:1"
}
]
},
"id": 10,
"id": 11,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -155,14 +161,14 @@
"nodeType": "FunctionDefinition",
"parameters":
{
"id": 6,
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "61:2:1"
},
"returnParameters":
{
"id": 7,
"id": 8,
"nodeType": "ParameterList",
"parameters": [],
"src": "76:0:1"

View File

@ -53,14 +53,9 @@
{
"id": 2,
"name": "A",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "29:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$1",
"typeString": "contract A"
}
"src": "29:1:1"
},
"id": 3,
"nodeType": "InheritanceSpecifier",
@ -94,14 +89,9 @@
{
"id": 5,
"name": "B",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 4,
"src": "49:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$4",
"typeString": "contract B"
}
"src": "49:1:1"
},
"id": 6,
"nodeType": "InheritanceSpecifier",
@ -137,14 +127,9 @@
{
"id": 8,
"name": "C",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 7,
"src": "69:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C_$7",
"typeString": "contract C"
}
"src": "69:1:1"
},
"id": 9,
"nodeType": "InheritanceSpecifier",
@ -182,14 +167,9 @@
{
"id": 11,
"name": "D",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "89:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_D_$10",
"typeString": "contract D"
}
"src": "89:1:1"
},
"id": 12,
"nodeType": "InheritanceSpecifier",

View File

@ -89,11 +89,10 @@
"attributes":
{
"name": "A",
"referencedDeclaration": 1,
"type": "contract A"
"referencedDeclaration": 1
},
"id": 2,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "29:1:1"
}
],
@ -140,11 +139,10 @@
"attributes":
{
"name": "B",
"referencedDeclaration": 4,
"type": "contract B"
"referencedDeclaration": 4
},
"id": 5,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "49:1:1"
}
],
@ -193,11 +191,10 @@
"attributes":
{
"name": "C",
"referencedDeclaration": 7,
"type": "contract C"
"referencedDeclaration": 7
},
"id": 8,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "69:1:1"
}
],
@ -248,11 +245,10 @@
"attributes":
{
"name": "D",
"referencedDeclaration": 10,
"type": "contract D"
"referencedDeclaration": 10
},
"id": 11,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "89:1:1"
}
],

View File

@ -24,9 +24,8 @@
{
"id": 2,
"name": "A",
"nodeType": "UserDefinedTypeName",
"src": "29:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "29:1:1"
},
"id": 3,
"nodeType": "InheritanceSpecifier",
@ -50,9 +49,8 @@
{
"id": 5,
"name": "B",
"nodeType": "UserDefinedTypeName",
"src": "49:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "49:1:1"
},
"id": 6,
"nodeType": "InheritanceSpecifier",
@ -76,9 +74,8 @@
{
"id": 8,
"name": "C",
"nodeType": "UserDefinedTypeName",
"src": "69:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "69:1:1"
},
"id": 9,
"nodeType": "InheritanceSpecifier",
@ -102,9 +99,8 @@
{
"id": 11,
"name": "D",
"nodeType": "UserDefinedTypeName",
"src": "89:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "89:1:1"
},
"id": 12,
"nodeType": "InheritanceSpecifier",

View File

@ -41,14 +41,9 @@
{
"id": 2,
"name": "C1",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "30:2:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C1_$1",
"typeString": "contract C1"
}
"src": "30:2:1"
},
"id": 3,
"nodeType": "InheritanceSpecifier",

View File

@ -77,11 +77,10 @@
"attributes":
{
"name": "C1",
"referencedDeclaration": 1,
"type": "contract C1"
"referencedDeclaration": 1
},
"id": 2,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "30:2:1"
}
],

View File

@ -24,9 +24,8 @@
{
"id": 2,
"name": "C1",
"nodeType": "UserDefinedTypeName",
"src": "30:2:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "30:2:1"
},
"id": 3,
"nodeType": "InheritanceSpecifier",

View File

@ -4,10 +4,10 @@
{
"C":
[
17
19
]
},
"id": 18,
"id": 20,
"nodeType": "SourceUnit",
"nodes":
[
@ -17,10 +17,10 @@
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 17,
"id": 19,
"linearizedBaseContracts":
[
17
19
],
"name": "C",
"nodeType": "ContractDefinition",
@ -56,32 +56,39 @@
},
{
"constant": false,
"id": 8,
"id": 9,
"mutability": "mutable",
"name": "a",
"nodeType": "VariableDeclaration",
"scope": 17,
"scope": 19,
"src": "40:20:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_contract$_C_$17_$_t_bool_$",
"typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$",
"typeString": "mapping(contract C => bool)"
},
"typeName":
{
"id": 7,
"id": 8,
"keyType":
{
"id": 5,
"name": "C",
"id": 6,
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 17,
"pathNode":
{
"id": 5,
"name": "C",
"nodeType": "IdentifierPath",
"referencedDeclaration": 19,
"src": "48:1:1"
},
"referencedDeclaration": 19,
"src": "48:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C_$17",
"typeIdentifier": "t_contract$_C_$19",
"typeString": "contract C"
}
},
@ -89,12 +96,12 @@
"src": "40:18:1",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_contract$_C_$17_$_t_bool_$",
"typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$",
"typeString": "mapping(contract C => bool)"
},
"valueType":
{
"id": 6,
"id": 7,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "53:4:1",
@ -109,11 +116,11 @@
},
{
"constant": false,
"id": 12,
"id": 13,
"mutability": "mutable",
"name": "b",
"nodeType": "VariableDeclaration",
"scope": 17,
"scope": 19,
"src": "66:26:1",
"stateVariable": true,
"storageLocation": "default",
@ -124,10 +131,10 @@
},
"typeName":
{
"id": 11,
"id": 12,
"keyType":
{
"id": 9,
"id": 10,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "74:7:1",
@ -146,7 +153,7 @@
},
"valueType":
{
"id": 10,
"id": 11,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "85:4:1",
@ -161,11 +168,11 @@
},
{
"constant": false,
"id": 16,
"id": 18,
"mutability": "mutable",
"name": "c",
"nodeType": "VariableDeclaration",
"scope": 17,
"scope": 19,
"src": "98:20:1",
"stateVariable": true,
"storageLocation": "default",
@ -176,12 +183,19 @@
},
"typeName":
{
"id": 15,
"id": 17,
"keyType":
{
"id": 13,
"name": "E",
"id": 15,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 14,
"name": "E",
"nodeType": "IdentifierPath",
"referencedDeclaration": 4,
"src": "106:1:1"
},
"referencedDeclaration": 4,
"src": "106:1:1",
"typeDescriptions":
@ -199,7 +213,7 @@
},
"valueType":
{
"id": 14,
"id": 16,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "111:4:1",
@ -213,7 +227,7 @@
"visibility": "internal"
}
],
"scope": 18,
"scope": 20,
"src": "0:121:1"
}
],

View File

@ -6,7 +6,7 @@
{
"C":
[
17
19
]
}
},
@ -28,10 +28,10 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
17
19
],
"name": "C",
"scope": 18
"scope": 20
},
"children":
[
@ -81,7 +81,7 @@
"constant": false,
"mutability": "mutable",
"name": "a",
"scope": 17,
"scope": 19,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(contract C => bool)",
@ -99,11 +99,23 @@
{
"attributes":
{
"name": "C",
"referencedDeclaration": 17,
"referencedDeclaration": 19,
"type": "contract C"
},
"id": 5,
"children":
[
{
"attributes":
{
"name": "C",
"referencedDeclaration": 19
},
"id": 5,
"name": "IdentifierPath",
"src": "48:1:1"
}
],
"id": 6,
"name": "UserDefinedTypeName",
"src": "48:1:1"
},
@ -113,17 +125,17 @@
"name": "bool",
"type": "bool"
},
"id": 6,
"id": 7,
"name": "ElementaryTypeName",
"src": "53:4:1"
}
],
"id": 7,
"id": 8,
"name": "Mapping",
"src": "40:18:1"
}
],
"id": 8,
"id": 9,
"name": "VariableDeclaration",
"src": "40:20:1"
},
@ -133,7 +145,7 @@
"constant": false,
"mutability": "mutable",
"name": "b",
"scope": 17,
"scope": 19,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(address => bool)",
@ -154,7 +166,7 @@
"name": "address",
"type": "address"
},
"id": 9,
"id": 10,
"name": "ElementaryTypeName",
"src": "74:7:1"
},
@ -164,17 +176,17 @@
"name": "bool",
"type": "bool"
},
"id": 10,
"id": 11,
"name": "ElementaryTypeName",
"src": "85:4:1"
}
],
"id": 11,
"id": 12,
"name": "Mapping",
"src": "66:24:1"
}
],
"id": 12,
"id": 13,
"name": "VariableDeclaration",
"src": "66:26:1"
},
@ -184,7 +196,7 @@
"constant": false,
"mutability": "mutable",
"name": "c",
"scope": 17,
"scope": 19,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(enum C.E => bool)",
@ -202,11 +214,23 @@
{
"attributes":
{
"name": "E",
"referencedDeclaration": 4,
"type": "enum C.E"
},
"id": 13,
"children":
[
{
"attributes":
{
"name": "E",
"referencedDeclaration": 4
},
"id": 14,
"name": "IdentifierPath",
"src": "106:1:1"
}
],
"id": 15,
"name": "UserDefinedTypeName",
"src": "106:1:1"
},
@ -216,27 +240,27 @@
"name": "bool",
"type": "bool"
},
"id": 14,
"id": 16,
"name": "ElementaryTypeName",
"src": "111:4:1"
}
],
"id": 15,
"id": 17,
"name": "Mapping",
"src": "98:18:1"
}
],
"id": 16,
"id": 18,
"name": "VariableDeclaration",
"src": "98:20:1"
}
],
"id": 17,
"id": 19,
"name": "ContractDefinition",
"src": "0:121:1"
}
],
"id": 18,
"id": 20,
"name": "SourceUnit",
"src": "0:122:1"
}

View File

@ -1,6 +1,6 @@
{
"absolutePath": "a",
"id": 18,
"id": 20,
"nodeType": "SourceUnit",
"nodes":
[
@ -9,7 +9,7 @@
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"id": 17,
"id": 19,
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
@ -43,7 +43,7 @@
},
{
"constant": false,
"id": 8,
"id": 9,
"mutability": "mutable",
"name": "a",
"nodeType": "VariableDeclaration",
@ -53,12 +53,18 @@
"typeDescriptions": {},
"typeName":
{
"id": 7,
"id": 8,
"keyType":
{
"id": 5,
"name": "C",
"id": 6,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 5,
"name": "C",
"nodeType": "IdentifierPath",
"src": "48:1:1"
},
"src": "48:1:1",
"typeDescriptions": {}
},
@ -67,7 +73,7 @@
"typeDescriptions": {},
"valueType":
{
"id": 6,
"id": 7,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "53:4:1",
@ -78,7 +84,7 @@
},
{
"constant": false,
"id": 12,
"id": 13,
"mutability": "mutable",
"name": "b",
"nodeType": "VariableDeclaration",
@ -88,10 +94,10 @@
"typeDescriptions": {},
"typeName":
{
"id": 11,
"id": 12,
"keyType":
{
"id": 9,
"id": 10,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "74:7:1",
@ -102,7 +108,7 @@
"typeDescriptions": {},
"valueType":
{
"id": 10,
"id": 11,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "85:4:1",
@ -113,7 +119,7 @@
},
{
"constant": false,
"id": 16,
"id": 18,
"mutability": "mutable",
"name": "c",
"nodeType": "VariableDeclaration",
@ -123,12 +129,18 @@
"typeDescriptions": {},
"typeName":
{
"id": 15,
"id": 17,
"keyType":
{
"id": 13,
"name": "E",
"id": 15,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 14,
"name": "E",
"nodeType": "IdentifierPath",
"src": "106:1:1"
},
"src": "106:1:1",
"typeDescriptions": {}
},
@ -137,7 +149,7 @@
"typeDescriptions": {},
"valueType":
{
"id": 14,
"id": 16,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "111:4:1",

View File

@ -126,15 +126,9 @@
{
"id": 8,
"name": "M",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"nodeType": "IdentifierPath",
"referencedDeclaration": 6,
"src": "52:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_modifier$_t_uint256_$",
"typeString": "modifier (uint256)"
}
"src": "52:1:1"
},
"nodeType": "ModifierInvocation",
"src": "52:4:1"

View File

@ -146,16 +146,11 @@
{
"attributes":
{
"overloadedDeclarations":
[
null
],
"referencedDeclaration": 6,
"type": "modifier (uint256)",
"value": "M"
"name": "M",
"referencedDeclaration": 6
},
"id": 8,
"name": "Identifier",
"name": "IdentifierPath",
"src": "52:1:1"
},
{

View File

@ -96,10 +96,8 @@
{
"id": 8,
"name": "M",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"src": "52:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "52:1:1"
},
"nodeType": "ModifierInvocation",
"src": "52:4:1"

View File

@ -126,15 +126,9 @@
{
"id": 8,
"name": "M",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"nodeType": "IdentifierPath",
"referencedDeclaration": 6,
"src": "52:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_modifier$_t_uint256_$",
"typeString": "modifier (uint256)"
}
"src": "52:1:1"
},
"nodeType": "ModifierInvocation",
"src": "52:4:1"

View File

@ -146,16 +146,11 @@
{
"attributes":
{
"overloadedDeclarations":
[
null
],
"referencedDeclaration": 6,
"type": "modifier (uint256)",
"value": "M"
"name": "M",
"referencedDeclaration": 6
},
"id": 8,
"name": "Identifier",
"name": "IdentifierPath",
"src": "52:1:1"
},
{

View File

@ -96,10 +96,8 @@
{
"id": 8,
"name": "M",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"src": "52:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "52:1:1"
},
"nodeType": "ModifierInvocation",
"src": "52:4:1"

View File

@ -1,6 +1,6 @@
{
"absolutePath": "a",
"id": 11,
"id": 12,
"nodeType": "SourceUnit",
"nodes":
[
@ -21,9 +21,8 @@
{
"id": 2,
"name": "NotExisting.X",
"nodeType": "UserDefinedTypeName",
"src": "55:13:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "55:13:1"
},
"id": 3,
"nodeType": "InheritanceSpecifier",
@ -32,14 +31,14 @@
],
"contractDependencies": [],
"contractKind": "contract",
"id": 10,
"id": 11,
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"constant": false,
"id": 5,
"id": 6,
"mutability": "mutable",
"name": "myStruct",
"nodeType": "VariableDeclaration",
@ -49,9 +48,15 @@
"typeDescriptions": {},
"typeName":
{
"id": 4,
"name": "NotExisting.SomeStruct",
"id": 5,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 4,
"name": "NotExisting.SomeStruct",
"nodeType": "IdentifierPath",
"src": "72:22:1"
},
"src": "72:22:1",
"typeDescriptions": {}
},
@ -60,12 +65,12 @@
{
"body":
{
"id": 8,
"id": 9,
"nodeType": "Block",
"src": "127:2:1",
"statements": []
},
"id": 9,
"id": 10,
"implemented": true,
"kind": "constructor",
"modifiers": [],
@ -73,14 +78,14 @@
"nodeType": "FunctionDefinition",
"parameters":
{
"id": 6,
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "124:2:1"
},
"returnParameters":
{
"id": 7,
"id": 8,
"nodeType": "ParameterList",
"parameters": [],
"src": "127:0:1"

View File

@ -82,14 +82,9 @@
{
"id": 6,
"name": "A",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "55:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "55:1:1"
},
"id": 7,
"nodeType": "InheritanceSpecifier",
@ -199,14 +194,9 @@
{
"id": 17,
"name": "B",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 16,
"src": "134:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$16",
"typeString": "contract B"
}
"src": "134:1:1"
},
"id": 18,
"nodeType": "InheritanceSpecifier",
@ -305,26 +295,16 @@
{
"id": 25,
"name": "A",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "206:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "206:1:1"
},
{
"id": 26,
"name": "B",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 16,
"src": "209:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$16",
"typeString": "contract B"
}
"src": "209:1:1"
}
],
"src": "197:14:1"

View File

@ -139,11 +139,10 @@
"attributes":
{
"name": "A",
"referencedDeclaration": 5,
"type": "contract A"
"referencedDeclaration": 5
},
"id": 6,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "55:1:1"
}
],
@ -315,11 +314,10 @@
"attributes":
{
"name": "B",
"referencedDeclaration": 16,
"type": "contract B"
"referencedDeclaration": 16
},
"id": 17,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "134:1:1"
}
],
@ -436,22 +434,20 @@
"attributes":
{
"name": "A",
"referencedDeclaration": 5,
"type": "contract A"
"referencedDeclaration": 5
},
"id": 25,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "206:1:1"
},
{
"attributes":
{
"name": "B",
"referencedDeclaration": 16,
"type": "contract B"
"referencedDeclaration": 16
},
"id": 26,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "209:1:1"
}
],

View File

@ -59,9 +59,8 @@
{
"id": 6,
"name": "A",
"nodeType": "UserDefinedTypeName",
"src": "55:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "55:1:1"
},
"id": 7,
"nodeType": "InheritanceSpecifier",
@ -153,9 +152,8 @@
{
"id": 17,
"name": "B",
"nodeType": "UserDefinedTypeName",
"src": "134:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "134:1:1"
},
"id": 18,
"nodeType": "InheritanceSpecifier",
@ -232,16 +230,14 @@
{
"id": 25,
"name": "A",
"nodeType": "UserDefinedTypeName",
"src": "206:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "206:1:1"
},
{
"id": 26,
"name": "B",
"nodeType": "UserDefinedTypeName",
"src": "209:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "209:1:1"
}
],
"src": "197:14:1"

View File

@ -136,14 +136,9 @@
{
"id": 11,
"name": "A",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "114:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "114:1:1"
},
"id": 12,
"nodeType": "InheritanceSpecifier",
@ -154,14 +149,9 @@
{
"id": 13,
"name": "B",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "117:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$10",
"typeString": "contract B"
}
"src": "117:1:1"
},
"id": 14,
"nodeType": "InheritanceSpecifier",
@ -215,26 +205,16 @@
{
"id": 16,
"name": "A",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "154:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "154:1:1"
},
{
"id": 17,
"name": "B",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "157:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$10",
"typeString": "contract B"
}
"src": "157:1:1"
}
],
"src": "145:14:1"

View File

@ -232,11 +232,10 @@
"attributes":
{
"name": "A",
"referencedDeclaration": 5,
"type": "contract A"
"referencedDeclaration": 5
},
"id": 11,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "114:1:1"
}
],
@ -252,11 +251,10 @@
"attributes":
{
"name": "B",
"referencedDeclaration": 10,
"type": "contract B"
"referencedDeclaration": 10
},
"id": 13,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "117:1:1"
}
],
@ -295,22 +293,20 @@
"attributes":
{
"name": "A",
"referencedDeclaration": 5,
"type": "contract A"
"referencedDeclaration": 5
},
"id": 16,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "154:1:1"
},
{
"attributes":
{
"name": "B",
"referencedDeclaration": 10,
"type": "contract B"
"referencedDeclaration": 10
},
"id": 17,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "157:1:1"
}
],

View File

@ -105,9 +105,8 @@
{
"id": 11,
"name": "A",
"nodeType": "UserDefinedTypeName",
"src": "114:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "114:1:1"
},
"id": 12,
"nodeType": "InheritanceSpecifier",
@ -118,9 +117,8 @@
{
"id": 13,
"name": "B",
"nodeType": "UserDefinedTypeName",
"src": "117:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "117:1:1"
},
"id": 14,
"nodeType": "InheritanceSpecifier",
@ -157,16 +155,14 @@
{
"id": 16,
"name": "A",
"nodeType": "UserDefinedTypeName",
"src": "154:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "154:1:1"
},
{
"id": 17,
"name": "B",
"nodeType": "UserDefinedTypeName",
"src": "157:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "157:1:1"
}
],
"src": "145:14:1"

View File

@ -53,14 +53,9 @@
{
"id": 2,
"name": "L",
"nodeType": "UserDefinedTypeName",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "32:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_L_$1",
"typeString": "library L"
}
"src": "32:1:1"
},
"nodeType": "UsingForDirective",
"src": "26:17:1",

View File

@ -75,11 +75,10 @@
"attributes":
{
"name": "L",
"referencedDeclaration": 1,
"type": "library L"
"referencedDeclaration": 1
},
"id": 2,
"name": "UserDefinedTypeName",
"name": "IdentifierPath",
"src": "32:1:1"
},
{

View File

@ -31,9 +31,8 @@
{
"id": 2,
"name": "L",
"nodeType": "UserDefinedTypeName",
"src": "32:1:1",
"typeDescriptions": {}
"nodeType": "IdentifierPath",
"src": "32:1:1"
},
"nodeType": "UsingForDirective",
"src": "26:17:1",

View File

@ -0,0 +1,25 @@
==== Source: A ====
contract C {
int private x;
constructor (int p) public { x = p; }
function getX() public returns (int) { return x; }
}
==== Source: B ====
import "A" as M;
contract D is M.C {
constructor (int p) M.C(p) public {}
}
contract A {
function g(int p) public returns (int) {
D d = new D(p);
return d.getX();
}
}
// ====
// compileViaYul: also
// ----
// g(int256): -1 -> -1
// g(int256): 10 -> 10

View File

@ -17,3 +17,4 @@ contract C
}
}
// ----
// Warning 4661: (297-321): BMC: Assertion violation happens here.

View File

@ -1,4 +1,4 @@
function fun() someModifier {
}
// ----
// DeclarationError 7576: (15-27): Undeclared identifier.
// DeclarationError 7920: (15-27): Identifier not found or not unique.

View File

@ -6,4 +6,4 @@ function fun() C.someModifier {
}
// ----
// ParserError 2314: (65-66): Expected '{' but got '.'
// SyntaxError 5811: (49-83): Free functions cannot have modifiers.

View File

@ -4,4 +4,4 @@ contract C {
}
// ----
// SyntaxError 2668: (83-99): Functions without implementation cannot have modifiers.
// DeclarationError 7576: (97-98): Undeclared identifier.
// DeclarationError 7920: (97-98): Identifier not found or not unique.