Allow path syntax for super constructor calls

This commit is contained in:
Mathias Baumann 2020-08-11 11:18:22 +02:00
parent 0b7b174945
commit 006e5f2e1f
57 changed files with 579 additions and 893 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,7 +217,7 @@ 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;
solAssert(decl, "Expected declaration to be resolved.");

View File

@ -183,11 +183,6 @@ void ReferencesResolver::endVisit(IdentifierPath const& _path)
_path.annotation().referencedDeclaration = declaration;
}
void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName)
{
_typeName.annotation().referencedDeclaration = _typeName.pathNode()->annotation().referencedDeclaration;
}
bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
{
m_resolver.warnVariablesNamedLikeInstructions();

View File

@ -82,8 +82,7 @@ private:
void endVisit(FunctionDefinition const& _functionDefinition) override;
bool visit(ModifierDefinition const& _modifierDefinition) override;
void endVisit(ModifierDefinition const& _modifierDefinition) override;
void endVisit(IdentifierPath const& _typeName) 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

@ -558,7 +558,7 @@ private:
};
/**
* A sequence of identifiers separated by dots
* 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
{
@ -584,7 +584,7 @@ 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))
@ -595,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;
};
@ -617,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))
@ -628,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;
};
@ -792,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))
@ -803,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
@ -1077,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))
@ -1088,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;
};
@ -1225,15 +1225,15 @@ class UserDefinedTypeName: public TypeName
{
public:
UserDefinedTypeName(int64_t _id, SourceLocation const& _location, ASTPointer<IdentifierPath> _namePath):
TypeName(_id, _location), m_namePath(std::move(_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->path(); }
ASTPointer<IdentifierPath> const& pathNode() const { return m_namePath; }
UserDefinedTypeNameAnnotation& annotation() const override;
IdentifierPath& pathNode() const { return *m_namePath; }
private:
ASTPointer<IdentifierPath> m_namePath;

View File

@ -233,16 +233,12 @@ struct TypeNameAnnotation: ASTAnnotation
TypePointer type = nullptr;
};
struct IdentifierPathAnnotation: TypeNameAnnotation
{
/// Referenced declaration, set during reference resolution stage.
Declaration const* referencedDeclaration = 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

@ -493,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;
@ -528,8 +528,8 @@ bool ASTJsonConverter::visit(ElementaryTypeName const& _node)
bool ASTJsonConverter::visit(UserDefinedTypeName const& _node)
{
setJsonNode(_node, "UserDefinedTypeName", {
make_pair("pathNode", toJson(*_node.pathNode())),
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

@ -116,7 +116,7 @@ ASTPointer<ASTNode> ASTJsonImporter::convertJsonToASTNode(Json::Value const& _js
if (nodeType == "ContractDefinition")
return createContractDefinition(_json);
if (nodeType == "IdentifierPath")
return createIdentifier(_json);
return createIdentifierPath(_json);
if (nodeType == "InheritanceSpecifier")
return createInheritanceSpecifier(_json);
if (nodeType == "UsingForDirective")
@ -309,12 +309,13 @@ ASTPointer<IdentifierPath> ASTJsonImporter::createIdentifierPath(Json::Value con
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
);
}
return createASTNode<IdentifierPath>(_node, namePath);
}
ASTPointer<InheritanceSpecifier> ASTJsonImporter::createInheritanceSpecifier(Json::Value const& _node)
@ -324,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)
);
}
@ -333,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"])
);
}
@ -383,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,
@ -499,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)
);
}

View File

@ -381,14 +381,14 @@ void ElementaryTypeName::accept(ASTConstVisitor& _visitor) const
void UserDefinedTypeName::accept(ASTVisitor& _visitor)
{
if (_visitor.visit(*this))
this->pathNode()->accept(_visitor);
this->pathNode().accept(_visitor);
_visitor.endVisit(*this);
}
void UserDefinedTypeName::accept(ASTConstVisitor& _visitor) const
{
if (_visitor.visit(*this))
this->pathNode()->accept(_visitor);
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)
{

View File

@ -34,17 +34,17 @@ Optimized IR:
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "D_10" {
object "D_9" {
code {
{
mstore(64, memoryguard(0x80))
if callvalue() { revert(0, 0) }
let _1 := datasize("D_10_deployed")
codecopy(0, dataoffset("D_10_deployed"), _1)
let _1 := datasize("D_9_deployed")
codecopy(0, dataoffset("D_9_deployed"), _1)
return(0, _1)
}
}
object "D_10_deployed" {
object "D_9_deployed" {
code {
{
mstore(64, 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

@ -4,4 +4,4 @@ pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name
","message":"Expected type name","severity":"error","sourceLocation":{"end":94,"file":"A","start":93},"type":"ParserError"},{"component":"general","errorCode":"3796","formattedMessage":"A:2:84: Warning: Recovered in ContractDefinition at '}'.
pragma solidity >=0.0; contract Errort6 { using foo for ; /* missing type name */ }
^
","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":120,"file":"A","start":119},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[4]},"id":5,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":4,"linearizedBaseContracts":[4],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":5,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}}
","message":"Recovered in ContractDefinition at '}'.","severity":"warning","sourceLocation":{"end":120,"file":"A","start":119},"type":"Warning"}],"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"Errort6":[3]},"id":4,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":3,"linearizedBaseContracts":[3],"name":"Errort6","nodeType":"ContractDefinition","nodes":[],"scope":4,"src":"59:35:0"}],"src":"36:84:0"},"id":0}}}

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

@ -8,22 +8,22 @@
],
"B":
[
5
4
],
"C":
[
9
7
],
"D":
[
13
10
],
"E":
[
17
13
]
},
"id": 18,
"id": 14,
"nodeType": "SourceUnit",
"nodes":
[
@ -41,7 +41,7 @@
"name": "A",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 18,
"scope": 14,
"src": "0:14:1"
},
{
@ -51,25 +51,13 @@
{
"baseName":
{
"id": 3,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 2,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "29:1:1"
},
"id": 2,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "29:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$1",
"typeString": "contract A"
}
"src": "29:1:1"
},
"id": 4,
"id": 3,
"nodeType": "InheritanceSpecifier",
"src": "29:1:1"
}
@ -80,16 +68,16 @@
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 5,
"id": 4,
"linearizedBaseContracts":
[
5,
4,
1
],
"name": "B",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 18,
"scope": 14,
"src": "15:19:1"
},
{
@ -99,25 +87,13 @@
{
"baseName":
{
"id": 7,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 6,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "49:1:1"
},
"referencedDeclaration": 5,
"src": "49:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$5",
"typeString": "contract B"
}
"id": 5,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 4,
"src": "49:1:1"
},
"id": 8,
"id": 6,
"nodeType": "InheritanceSpecifier",
"src": "49:1:1"
}
@ -125,21 +101,21 @@
"contractDependencies":
[
1,
5
4
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 9,
"id": 7,
"linearizedBaseContracts":
[
9,
5,
7,
4,
1
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 18,
"scope": 14,
"src": "35:19:1"
},
{
@ -149,25 +125,13 @@
{
"baseName":
{
"id": 11,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 10,
"name": "C",
"nodeType": "IdentifierPath",
"referencedDeclaration": 9,
"src": "69:1:1"
},
"referencedDeclaration": 9,
"src": "69:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C_$9",
"typeString": "contract C"
}
"id": 8,
"name": "C",
"nodeType": "IdentifierPath",
"referencedDeclaration": 7,
"src": "69:1:1"
},
"id": 12,
"id": 9,
"nodeType": "InheritanceSpecifier",
"src": "69:1:1"
}
@ -175,23 +139,23 @@
"contractDependencies":
[
1,
5,
9
4,
7
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 13,
"id": 10,
"linearizedBaseContracts":
[
13,
9,
5,
10,
7,
4,
1
],
"name": "D",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 18,
"scope": 14,
"src": "55:19:1"
},
{
@ -201,25 +165,13 @@
{
"baseName":
{
"id": 15,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 14,
"name": "D",
"nodeType": "IdentifierPath",
"referencedDeclaration": 13,
"src": "89:1:1"
},
"referencedDeclaration": 13,
"src": "89:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_D_$13",
"typeString": "contract D"
}
"id": 11,
"name": "D",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "89:1:1"
},
"id": 16,
"id": 12,
"nodeType": "InheritanceSpecifier",
"src": "89:1:1"
}
@ -227,25 +179,25 @@
"contractDependencies":
[
1,
5,
9,
13
4,
7,
10
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 17,
"id": 13,
"linearizedBaseContracts":
[
17,
13,
9,
5,
10,
7,
4,
1
],
"name": "E",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 18,
"scope": 14,
"src": "75:19:1"
}
],

View File

@ -10,19 +10,19 @@
],
"B":
[
5
4
],
"C":
[
9
7
],
"D":
[
13
10
],
"E":
[
17
13
]
}
},
@ -51,7 +51,7 @@
[
null
],
"scope": 18
"scope": 14
},
"id": 1,
"name": "ContractDefinition",
@ -69,7 +69,7 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
5,
4,
1
],
"name": "B",
@ -77,7 +77,7 @@
[
null
],
"scope": 18
"scope": 14
},
"children":
[
@ -88,33 +88,20 @@
{
"attributes":
{
"referencedDeclaration": 1,
"type": "contract A"
"name": "A",
"referencedDeclaration": 1
},
"children":
[
{
"attributes":
{
"name": "A",
"referencedDeclaration": 1
},
"id": 2,
"name": "IdentifierPath",
"src": "29:1:1"
}
],
"id": 3,
"name": "UserDefinedTypeName",
"id": 2,
"name": "IdentifierPath",
"src": "29:1:1"
}
],
"id": 4,
"id": 3,
"name": "InheritanceSpecifier",
"src": "29:1:1"
}
],
"id": 5,
"id": 4,
"name": "ContractDefinition",
"src": "15:19:1"
},
@ -125,14 +112,14 @@
"contractDependencies":
[
1,
5
4
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
9,
5,
7,
4,
1
],
"name": "C",
@ -140,7 +127,7 @@
[
null
],
"scope": 18
"scope": 14
},
"children":
[
@ -151,33 +138,20 @@
{
"attributes":
{
"referencedDeclaration": 5,
"type": "contract B"
"name": "B",
"referencedDeclaration": 4
},
"children":
[
{
"attributes":
{
"name": "B",
"referencedDeclaration": 5
},
"id": 6,
"name": "IdentifierPath",
"src": "49:1:1"
}
],
"id": 7,
"name": "UserDefinedTypeName",
"id": 5,
"name": "IdentifierPath",
"src": "49:1:1"
}
],
"id": 8,
"id": 6,
"name": "InheritanceSpecifier",
"src": "49:1:1"
}
],
"id": 9,
"id": 7,
"name": "ContractDefinition",
"src": "35:19:1"
},
@ -188,16 +162,16 @@
"contractDependencies":
[
1,
5,
9
4,
7
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
13,
9,
5,
10,
7,
4,
1
],
"name": "D",
@ -205,7 +179,7 @@
[
null
],
"scope": 18
"scope": 14
},
"children":
[
@ -216,33 +190,20 @@
{
"attributes":
{
"referencedDeclaration": 9,
"type": "contract C"
"name": "C",
"referencedDeclaration": 7
},
"children":
[
{
"attributes":
{
"name": "C",
"referencedDeclaration": 9
},
"id": 10,
"name": "IdentifierPath",
"src": "69:1:1"
}
],
"id": 11,
"name": "UserDefinedTypeName",
"id": 8,
"name": "IdentifierPath",
"src": "69:1:1"
}
],
"id": 12,
"id": 9,
"name": "InheritanceSpecifier",
"src": "69:1:1"
}
],
"id": 13,
"id": 10,
"name": "ContractDefinition",
"src": "55:19:1"
},
@ -253,18 +214,18 @@
"contractDependencies":
[
1,
5,
9,
13
4,
7,
10
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
17,
13,
9,
5,
10,
7,
4,
1
],
"name": "E",
@ -272,7 +233,7 @@
[
null
],
"scope": 18
"scope": 14
},
"children":
[
@ -283,38 +244,25 @@
{
"attributes":
{
"referencedDeclaration": 13,
"type": "contract D"
"name": "D",
"referencedDeclaration": 10
},
"children":
[
{
"attributes":
{
"name": "D",
"referencedDeclaration": 13
},
"id": 14,
"name": "IdentifierPath",
"src": "89:1:1"
}
],
"id": 15,
"name": "UserDefinedTypeName",
"id": 11,
"name": "IdentifierPath",
"src": "89:1:1"
}
],
"id": 16,
"id": 12,
"name": "InheritanceSpecifier",
"src": "89:1:1"
}
],
"id": 17,
"id": 13,
"name": "ContractDefinition",
"src": "75:19:1"
}
],
"id": 18,
"id": 14,
"name": "SourceUnit",
"src": "0:95: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

@ -8,10 +8,10 @@
],
"C2":
[
5
4
]
},
"id": 6,
"id": 5,
"nodeType": "SourceUnit",
"nodes":
[
@ -29,7 +29,7 @@
"name": "C1",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 6,
"scope": 5,
"src": "0:14:1"
},
{
@ -39,25 +39,13 @@
{
"baseName":
{
"id": 3,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 2,
"name": "C1",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "30:2:1"
},
"id": 2,
"name": "C1",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "30:2:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C1_$1",
"typeString": "contract C1"
}
"src": "30:2:1"
},
"id": 4,
"id": 3,
"nodeType": "InheritanceSpecifier",
"src": "30:2:1"
}
@ -68,16 +56,16 @@
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 5,
"id": 4,
"linearizedBaseContracts":
[
5,
4,
1
],
"name": "C2",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 6,
"scope": 5,
"src": "15:20:1"
}
],

View File

@ -10,7 +10,7 @@
],
"C2":
[
5
4
]
}
},
@ -39,7 +39,7 @@
[
null
],
"scope": 6
"scope": 5
},
"id": 1,
"name": "ContractDefinition",
@ -57,7 +57,7 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
5,
4,
1
],
"name": "C2",
@ -65,7 +65,7 @@
[
null
],
"scope": 6
"scope": 5
},
"children":
[
@ -76,38 +76,25 @@
{
"attributes":
{
"referencedDeclaration": 1,
"type": "contract C1"
"name": "C1",
"referencedDeclaration": 1
},
"children":
[
{
"attributes":
{
"name": "C1",
"referencedDeclaration": 1
},
"id": 2,
"name": "IdentifierPath",
"src": "30:2:1"
}
],
"id": 3,
"name": "UserDefinedTypeName",
"id": 2,
"name": "IdentifierPath",
"src": "30:2:1"
}
],
"id": 4,
"id": 3,
"name": "InheritanceSpecifier",
"src": "30:2:1"
}
],
"id": 5,
"id": 4,
"name": "ContractDefinition",
"src": "15:20:1"
}
],
"id": 6,
"id": 5,
"name": "SourceUnit",
"src": "0:36: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

@ -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

@ -8,14 +8,14 @@
],
"B":
[
17
16
],
"C":
[
35
31
]
},
"id": 36,
"id": 32,
"nodeType": "SourceUnit",
"nodes":
[
@ -70,7 +70,7 @@
"visibility": "public"
}
],
"scope": 36,
"scope": 32,
"src": "0:40:1"
},
{
@ -80,25 +80,13 @@
{
"baseName":
{
"id": 7,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 6,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "55:1:1"
},
"id": 6,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "55:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "55:1:1"
},
"id": 8,
"id": 7,
"nodeType": "InheritanceSpecifier",
"src": "55:1:1"
}
@ -109,10 +97,10 @@
],
"contractKind": "contract",
"fullyImplemented": false,
"id": 17,
"id": 16,
"linearizedBaseContracts":
[
17,
16,
5
],
"name": "B",
@ -121,7 +109,7 @@
[
{
"functionSelector": "c2985578",
"id": 11,
"id": 10,
"implemented": false,
"kind": "function",
"modifiers": [],
@ -129,19 +117,19 @@
"nodeType": "FunctionDefinition",
"parameters":
{
"id": 9,
"id": 8,
"nodeType": "ParameterList",
"parameters": [],
"src": "72:2:1"
},
"returnParameters":
{
"id": 10,
"id": 9,
"nodeType": "ParameterList",
"parameters": [],
"src": "81:0:1"
},
"scope": 17,
"scope": 16,
"src": "60:22:1",
"stateMutability": "nonpayable",
"virtual": false,
@ -154,13 +142,13 @@
],
"body":
{
"id": 15,
"id": 14,
"nodeType": "Block",
"src": "115:2:1",
"statements": []
},
"functionSelector": "a399b6a2",
"id": 16,
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -168,33 +156,33 @@
"nodeType": "FunctionDefinition",
"overrides":
{
"id": 13,
"id": 12,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "106:8:1"
},
"parameters":
{
"id": 12,
"id": 11,
"nodeType": "ParameterList",
"parameters": [],
"src": "96:2:1"
},
"returnParameters":
{
"id": 14,
"id": 13,
"nodeType": "ParameterList",
"parameters": [],
"src": "115:0:1"
},
"scope": 17,
"scope": 16,
"src": "84:33:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 36,
"scope": 32,
"src": "41:78:1"
},
{
@ -204,25 +192,13 @@
{
"baseName":
{
"id": 19,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 18,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 17,
"src": "134:1:1"
},
"referencedDeclaration": 17,
"src": "134:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$17",
"typeString": "contract B"
}
"id": 17,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 16,
"src": "134:1:1"
},
"id": 20,
"id": 18,
"nodeType": "InheritanceSpecifier",
"src": "134:1:1"
}
@ -230,15 +206,15 @@
"contractDependencies":
[
5,
17
16
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 35,
"id": 31,
"linearizedBaseContracts":
[
35,
17,
31,
16,
5
],
"name": "C",
@ -248,17 +224,17 @@
{
"baseFunctions":
[
11
10
],
"body":
{
"id": 24,
"id": 22,
"nodeType": "Block",
"src": "170:3:1",
"statements": []
},
"functionSelector": "c2985578",
"id": 25,
"id": 23,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -266,26 +242,26 @@
"nodeType": "FunctionDefinition",
"overrides":
{
"id": 22,
"id": 20,
"nodeType": "OverrideSpecifier",
"overrides": [],
"src": "161:8:1"
},
"parameters":
{
"id": 21,
"id": 19,
"nodeType": "ParameterList",
"parameters": [],
"src": "151:2:1"
},
"returnParameters":
{
"id": 23,
"id": 21,
"nodeType": "ParameterList",
"parameters": [],
"src": "170:0:1"
},
"scope": 35,
"scope": 31,
"src": "139:34:1",
"stateMutability": "nonpayable",
"virtual": false,
@ -294,17 +270,17 @@
{
"baseFunctions":
[
16
15
],
"body":
{
"id": 33,
"id": 29,
"nodeType": "Block",
"src": "212:2:1",
"statements": []
},
"functionSelector": "a399b6a2",
"id": 34,
"id": 30,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -312,73 +288,49 @@
"nodeType": "FunctionDefinition",
"overrides":
{
"id": 31,
"id": 27,
"nodeType": "OverrideSpecifier",
"overrides":
[
{
"id": 28,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 27,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "206:1:1"
},
"id": 25,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "206:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "206:1:1"
},
{
"id": 30,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 29,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 17,
"src": "209:1:1"
},
"referencedDeclaration": 17,
"src": "209:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$17",
"typeString": "contract B"
}
"id": 26,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 16,
"src": "209:1:1"
}
],
"src": "197:14:1"
},
"parameters":
{
"id": 26,
"id": 24,
"nodeType": "ParameterList",
"parameters": [],
"src": "187:2:1"
},
"returnParameters":
{
"id": 32,
"id": 28,
"nodeType": "ParameterList",
"parameters": [],
"src": "212:0:1"
},
"scope": 35,
"scope": 31,
"src": "175:39:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 36,
"scope": 32,
"src": "120:96:1"
}
],

View File

@ -10,11 +10,11 @@
],
"B":
[
17
16
],
"C":
[
35
31
]
}
},
@ -39,7 +39,7 @@
5
],
"name": "A",
"scope": 36
"scope": 32
},
"children":
[
@ -123,11 +123,11 @@
"fullyImplemented": false,
"linearizedBaseContracts":
[
17,
16,
5
],
"name": "B",
"scope": 36
"scope": 32
},
"children":
[
@ -138,28 +138,15 @@
{
"attributes":
{
"referencedDeclaration": 5,
"type": "contract A"
"name": "A",
"referencedDeclaration": 5
},
"children":
[
{
"attributes":
{
"name": "A",
"referencedDeclaration": 5
},
"id": 6,
"name": "IdentifierPath",
"src": "55:1:1"
}
],
"id": 7,
"name": "UserDefinedTypeName",
"id": 6,
"name": "IdentifierPath",
"src": "55:1:1"
}
],
"id": 8,
"id": 7,
"name": "InheritanceSpecifier",
"src": "55:1:1"
},
@ -175,7 +162,7 @@
null
],
"name": "foo",
"scope": 17,
"scope": 16,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
@ -191,7 +178,7 @@
]
},
"children": [],
"id": 9,
"id": 8,
"name": "ParameterList",
"src": "72:2:1"
},
@ -204,12 +191,12 @@
]
},
"children": [],
"id": 10,
"id": 9,
"name": "ParameterList",
"src": "81:0:1"
}
],
"id": 11,
"id": 10,
"name": "FunctionDefinition",
"src": "60:22:1"
},
@ -229,7 +216,7 @@
null
],
"name": "faa",
"scope": 17,
"scope": 16,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
@ -244,7 +231,7 @@
null
]
},
"id": 13,
"id": 12,
"name": "OverrideSpecifier",
"src": "106:8:1"
},
@ -257,7 +244,7 @@
]
},
"children": [],
"id": 12,
"id": 11,
"name": "ParameterList",
"src": "96:2:1"
},
@ -270,7 +257,7 @@
]
},
"children": [],
"id": 14,
"id": 13,
"name": "ParameterList",
"src": "115:0:1"
},
@ -283,17 +270,17 @@
]
},
"children": [],
"id": 15,
"id": 14,
"name": "Block",
"src": "115:2:1"
}
],
"id": 16,
"id": 15,
"name": "FunctionDefinition",
"src": "84:33:1"
}
],
"id": 17,
"id": 16,
"name": "ContractDefinition",
"src": "41:78:1"
},
@ -304,18 +291,18 @@
"contractDependencies":
[
5,
17
16
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts":
[
35,
17,
31,
16,
5
],
"name": "C",
"scope": 36
"scope": 32
},
"children":
[
@ -326,28 +313,15 @@
{
"attributes":
{
"referencedDeclaration": 17,
"type": "contract B"
"name": "B",
"referencedDeclaration": 16
},
"children":
[
{
"attributes":
{
"name": "B",
"referencedDeclaration": 17
},
"id": 18,
"name": "IdentifierPath",
"src": "134:1:1"
}
],
"id": 19,
"name": "UserDefinedTypeName",
"id": 17,
"name": "IdentifierPath",
"src": "134:1:1"
}
],
"id": 20,
"id": 18,
"name": "InheritanceSpecifier",
"src": "134:1:1"
},
@ -356,7 +330,7 @@
{
"baseFunctions":
[
11
10
],
"functionSelector": "c2985578",
"implemented": true,
@ -367,7 +341,7 @@
null
],
"name": "foo",
"scope": 35,
"scope": 31,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
@ -382,7 +356,7 @@
null
]
},
"id": 22,
"id": 20,
"name": "OverrideSpecifier",
"src": "161:8:1"
},
@ -395,7 +369,7 @@
]
},
"children": [],
"id": 21,
"id": 19,
"name": "ParameterList",
"src": "151:2:1"
},
@ -408,7 +382,7 @@
]
},
"children": [],
"id": 23,
"id": 21,
"name": "ParameterList",
"src": "170:0:1"
},
@ -421,12 +395,12 @@
]
},
"children": [],
"id": 24,
"id": 22,
"name": "Block",
"src": "170:3:1"
}
],
"id": 25,
"id": 23,
"name": "FunctionDefinition",
"src": "139:34:1"
},
@ -435,7 +409,7 @@
{
"baseFunctions":
[
16
15
],
"functionSelector": "a399b6a2",
"implemented": true,
@ -446,7 +420,7 @@
null
],
"name": "faa",
"scope": 35,
"scope": 31,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
@ -459,51 +433,25 @@
{
"attributes":
{
"referencedDeclaration": 5,
"type": "contract A"
"name": "A",
"referencedDeclaration": 5
},
"children":
[
{
"attributes":
{
"name": "A",
"referencedDeclaration": 5
},
"id": 27,
"name": "IdentifierPath",
"src": "206:1:1"
}
],
"id": 28,
"name": "UserDefinedTypeName",
"id": 25,
"name": "IdentifierPath",
"src": "206:1:1"
},
{
"attributes":
{
"referencedDeclaration": 17,
"type": "contract B"
"name": "B",
"referencedDeclaration": 16
},
"children":
[
{
"attributes":
{
"name": "B",
"referencedDeclaration": 17
},
"id": 29,
"name": "IdentifierPath",
"src": "209:1:1"
}
],
"id": 30,
"name": "UserDefinedTypeName",
"id": 26,
"name": "IdentifierPath",
"src": "209:1:1"
}
],
"id": 31,
"id": 27,
"name": "OverrideSpecifier",
"src": "197:14:1"
},
@ -516,7 +464,7 @@
]
},
"children": [],
"id": 26,
"id": 24,
"name": "ParameterList",
"src": "187:2:1"
},
@ -529,7 +477,7 @@
]
},
"children": [],
"id": 32,
"id": 28,
"name": "ParameterList",
"src": "212:0:1"
},
@ -542,22 +490,22 @@
]
},
"children": [],
"id": 33,
"id": 29,
"name": "Block",
"src": "212:2:1"
}
],
"id": 34,
"id": 30,
"name": "FunctionDefinition",
"src": "175:39:1"
}
],
"id": 35,
"id": 31,
"name": "ContractDefinition",
"src": "120:96:1"
}
],
"id": 36,
"id": 32,
"name": "SourceUnit",
"src": "0:217: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

@ -12,10 +12,10 @@
],
"C":
[
26
22
]
},
"id": 27,
"id": 23,
"nodeType": "SourceUnit",
"nodes":
[
@ -70,7 +70,7 @@
"visibility": "public"
}
],
"scope": 27,
"scope": 23,
"src": "0:49:1"
},
{
@ -124,7 +124,7 @@
"visibility": "public"
}
],
"scope": 27,
"scope": 23,
"src": "50:49:1"
},
{
@ -134,50 +134,26 @@
{
"baseName":
{
"id": 12,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 11,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "114:1:1"
},
"id": 11,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "114:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "114:1:1"
},
"id": 13,
"id": 12,
"nodeType": "InheritanceSpecifier",
"src": "114:1:1"
},
{
"baseName":
{
"id": 15,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 14,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "117:1:1"
},
"id": 13,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "117:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_B_$10",
"typeString": "contract B"
}
"src": "117:1:1"
},
"id": 16,
"id": 14,
"nodeType": "InheritanceSpecifier",
"src": "117:1:1"
}
@ -189,10 +165,10 @@
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 26,
"id": 22,
"linearizedBaseContracts":
[
26,
22,
10,
5
],
@ -208,13 +184,13 @@
],
"body":
{
"id": 24,
"id": 20,
"nodeType": "Block",
"src": "160:2:1",
"statements": []
},
"functionSelector": "26121ff0",
"id": 25,
"id": 21,
"implemented": true,
"kind": "function",
"modifiers": [],
@ -222,73 +198,49 @@
"nodeType": "FunctionDefinition",
"overrides":
{
"id": 22,
"id": 18,
"nodeType": "OverrideSpecifier",
"overrides":
[
{
"id": 19,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 18,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "154:1:1"
},
"id": 16,
"name": "A",
"nodeType": "IdentifierPath",
"referencedDeclaration": 5,
"src": "154:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_A_$5",
"typeString": "contract A"
}
"src": "154:1:1"
},
{
"id": 21,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 20,
"name": "B",
"nodeType": "IdentifierPath",
"referencedDeclaration": 10,
"src": "157:1:1"
},
"id": 17,
"name": "B",
"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"
},
"parameters":
{
"id": 17,
"id": 15,
"nodeType": "ParameterList",
"parameters": [],
"src": "135:2:1"
},
"returnParameters":
{
"id": 23,
"id": 19,
"nodeType": "ParameterList",
"parameters": [],
"src": "160:0:1"
},
"scope": 26,
"scope": 22,
"src": "125:37:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 27,
"scope": 23,
"src": "100:64:1"
}
],

View File

@ -14,7 +14,7 @@
],
"C":
[
26
22
]
}
},
@ -39,7 +39,7 @@
5
],
"name": "A",
"scope": 27
"scope": 23
},
"children":
[
@ -130,7 +130,7 @@
10
],
"name": "B",
"scope": 27
"scope": 23
},
"children":
[
@ -215,12 +215,12 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
26,
22,
10,
5
],
"name": "C",
"scope": 27
"scope": 23
},
"children":
[
@ -231,28 +231,15 @@
{
"attributes":
{
"referencedDeclaration": 5,
"type": "contract A"
"name": "A",
"referencedDeclaration": 5
},
"children":
[
{
"attributes":
{
"name": "A",
"referencedDeclaration": 5
},
"id": 11,
"name": "IdentifierPath",
"src": "114:1:1"
}
],
"id": 12,
"name": "UserDefinedTypeName",
"id": 11,
"name": "IdentifierPath",
"src": "114:1:1"
}
],
"id": 13,
"id": 12,
"name": "InheritanceSpecifier",
"src": "114:1:1"
},
@ -263,28 +250,15 @@
{
"attributes":
{
"referencedDeclaration": 10,
"type": "contract B"
"name": "B",
"referencedDeclaration": 10
},
"children":
[
{
"attributes":
{
"name": "B",
"referencedDeclaration": 10
},
"id": 14,
"name": "IdentifierPath",
"src": "117:1:1"
}
],
"id": 15,
"name": "UserDefinedTypeName",
"id": 13,
"name": "IdentifierPath",
"src": "117:1:1"
}
],
"id": 16,
"id": 14,
"name": "InheritanceSpecifier",
"src": "117:1:1"
},
@ -305,7 +279,7 @@
null
],
"name": "f",
"scope": 26,
"scope": 22,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
@ -318,51 +292,25 @@
{
"attributes":
{
"referencedDeclaration": 5,
"type": "contract A"
"name": "A",
"referencedDeclaration": 5
},
"children":
[
{
"attributes":
{
"name": "A",
"referencedDeclaration": 5
},
"id": 18,
"name": "IdentifierPath",
"src": "154:1:1"
}
],
"id": 19,
"name": "UserDefinedTypeName",
"id": 16,
"name": "IdentifierPath",
"src": "154:1:1"
},
{
"attributes":
{
"referencedDeclaration": 10,
"type": "contract B"
"name": "B",
"referencedDeclaration": 10
},
"children":
[
{
"attributes":
{
"name": "B",
"referencedDeclaration": 10
},
"id": 20,
"name": "IdentifierPath",
"src": "157:1:1"
}
],
"id": 21,
"name": "UserDefinedTypeName",
"id": 17,
"name": "IdentifierPath",
"src": "157:1:1"
}
],
"id": 22,
"id": 18,
"name": "OverrideSpecifier",
"src": "145:14:1"
},
@ -375,7 +323,7 @@
]
},
"children": [],
"id": 17,
"id": 15,
"name": "ParameterList",
"src": "135:2:1"
},
@ -388,7 +336,7 @@
]
},
"children": [],
"id": 23,
"id": 19,
"name": "ParameterList",
"src": "160:0:1"
},
@ -401,22 +349,22 @@
]
},
"children": [],
"id": 24,
"id": 20,
"name": "Block",
"src": "160:2:1"
}
],
"id": 25,
"id": 21,
"name": "FunctionDefinition",
"src": "125:37:1"
}
],
"id": 26,
"id": 22,
"name": "ContractDefinition",
"src": "100:64:1"
}
],
"id": 27,
"id": 23,
"name": "SourceUnit",
"src": "0:165: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

@ -4,14 +4,14 @@
{
"C":
[
6
5
],
"L":
[
1
]
},
"id": 7,
"id": 6,
"nodeType": "SourceUnit",
"nodes":
[
@ -29,7 +29,7 @@
"name": "L",
"nodeType": "ContractDefinition",
"nodes": [],
"scope": 7,
"scope": 6,
"src": "0:12:1"
},
{
@ -38,42 +38,30 @@
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 6,
"id": 5,
"linearizedBaseContracts":
[
6
5
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"id": 5,
"id": 4,
"libraryName":
{
"id": 3,
"nodeType": "UserDefinedTypeName",
"pathNode":
{
"id": 2,
"name": "L",
"nodeType": "IdentifierPath",
"referencedDeclaration": 1,
"src": "32:1:1"
},
"id": 2,
"name": "L",
"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",
"typeName":
{
"id": 4,
"id": 3,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "38:4:1",
@ -85,7 +73,7 @@
}
}
],
"scope": 7,
"scope": 6,
"src": "13:32:1"
}
],

View File

@ -6,7 +6,7 @@
{
"C":
[
6
5
],
"L":
[
@ -39,7 +39,7 @@
[
null
],
"scope": 7
"scope": 6
},
"id": 1,
"name": "ContractDefinition",
@ -61,10 +61,10 @@
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
5
],
"name": "C",
"scope": 7
"scope": 6
},
"children":
[
@ -74,24 +74,11 @@
{
"attributes":
{
"referencedDeclaration": 1,
"type": "library L"
"name": "L",
"referencedDeclaration": 1
},
"children":
[
{
"attributes":
{
"name": "L",
"referencedDeclaration": 1
},
"id": 2,
"name": "IdentifierPath",
"src": "32:1:1"
}
],
"id": 3,
"name": "UserDefinedTypeName",
"id": 2,
"name": "IdentifierPath",
"src": "32:1:1"
},
{
@ -100,22 +87,22 @@
"name": "uint",
"type": "uint256"
},
"id": 4,
"id": 3,
"name": "ElementaryTypeName",
"src": "38:4:1"
}
],
"id": 5,
"id": 4,
"name": "UsingForDirective",
"src": "26:17:1"
}
],
"id": 6,
"id": 5,
"name": "ContractDefinition",
"src": "13:32:1"
}
],
"id": 7,
"id": 6,
"name": "SourceUnit",
"src": "0:46: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.