mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Parse override keyword
This commit is contained in:
parent
502bf01be2
commit
24716404f8
@ -171,6 +171,7 @@ namespace langutil
|
|||||||
K(Memory, "memory", 0) \
|
K(Memory, "memory", 0) \
|
||||||
K(Modifier, "modifier", 0) \
|
K(Modifier, "modifier", 0) \
|
||||||
K(New, "new", 0) \
|
K(New, "new", 0) \
|
||||||
|
K(Override, "override", 0) \
|
||||||
K(Payable, "payable", 0) \
|
K(Payable, "payable", 0) \
|
||||||
K(Public, "public", 0) \
|
K(Public, "public", 0) \
|
||||||
K(Pragma, "pragma", 0) \
|
K(Pragma, "pragma", 0) \
|
||||||
@ -248,7 +249,6 @@ namespace langutil
|
|||||||
K(Mutable, "mutable", 0) \
|
K(Mutable, "mutable", 0) \
|
||||||
K(NullLiteral, "null", 0) \
|
K(NullLiteral, "null", 0) \
|
||||||
K(Of, "of", 0) \
|
K(Of, "of", 0) \
|
||||||
K(Override, "override", 0) \
|
|
||||||
K(Partial, "partial", 0) \
|
K(Partial, "partial", 0) \
|
||||||
K(Promise, "promise", 0) \
|
K(Promise, "promise", 0) \
|
||||||
K(Reference, "reference", 0) \
|
K(Reference, "reference", 0) \
|
||||||
|
@ -604,6 +604,32 @@ protected:
|
|||||||
ASTPointer<ParameterList> m_returnParameters;
|
ASTPointer<ParameterList> m_returnParameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function override specifier. Consists of a single override keyword
|
||||||
|
* potentially followed by a parenthesized list of base contract names.
|
||||||
|
*/
|
||||||
|
class OverrideSpecifier: public ASTNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OverrideSpecifier(
|
||||||
|
SourceLocation const& _location,
|
||||||
|
std::vector<ASTPointer<UserDefinedTypeName>> const& _overrides
|
||||||
|
):
|
||||||
|
ASTNode(_location),
|
||||||
|
m_overrides(_overrides)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void accept(ASTVisitor& _visitor) override;
|
||||||
|
void accept(ASTConstVisitor& _visitor) const override;
|
||||||
|
|
||||||
|
/// @returns the list of specific overrides, if any
|
||||||
|
std::vector<ASTPointer<UserDefinedTypeName>> const& overrides() const { return m_overrides; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<ASTPointer<UserDefinedTypeName>> m_overrides;
|
||||||
|
};
|
||||||
|
|
||||||
class FunctionDefinition: public CallableDeclaration, public Documented, public ImplementationOptional
|
class FunctionDefinition: public CallableDeclaration, public Documented, public ImplementationOptional
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -613,6 +639,7 @@ public:
|
|||||||
Declaration::Visibility _visibility,
|
Declaration::Visibility _visibility,
|
||||||
StateMutability _stateMutability,
|
StateMutability _stateMutability,
|
||||||
bool _isConstructor,
|
bool _isConstructor,
|
||||||
|
ASTPointer<OverrideSpecifier> const& _overrides,
|
||||||
ASTPointer<ASTString> const& _documentation,
|
ASTPointer<ASTString> const& _documentation,
|
||||||
ASTPointer<ParameterList> const& _parameters,
|
ASTPointer<ParameterList> const& _parameters,
|
||||||
std::vector<ASTPointer<ModifierInvocation>> const& _modifiers,
|
std::vector<ASTPointer<ModifierInvocation>> const& _modifiers,
|
||||||
@ -624,6 +651,7 @@ public:
|
|||||||
ImplementationOptional(_body != nullptr),
|
ImplementationOptional(_body != nullptr),
|
||||||
m_stateMutability(_stateMutability),
|
m_stateMutability(_stateMutability),
|
||||||
m_isConstructor(_isConstructor),
|
m_isConstructor(_isConstructor),
|
||||||
|
m_overrides(_overrides),
|
||||||
m_functionModifiers(_modifiers),
|
m_functionModifiers(_modifiers),
|
||||||
m_body(_body)
|
m_body(_body)
|
||||||
{}
|
{}
|
||||||
@ -633,6 +661,7 @@ public:
|
|||||||
|
|
||||||
StateMutability stateMutability() const { return m_stateMutability; }
|
StateMutability stateMutability() const { return m_stateMutability; }
|
||||||
bool isConstructor() const { return m_isConstructor; }
|
bool isConstructor() const { return m_isConstructor; }
|
||||||
|
ASTPointer<OverrideSpecifier> const& overrides() const { return m_overrides; }
|
||||||
bool isFallback() const { return !m_isConstructor && name().empty(); }
|
bool isFallback() const { return !m_isConstructor && name().empty(); }
|
||||||
bool isPayable() const { return m_stateMutability == StateMutability::Payable; }
|
bool isPayable() const { return m_stateMutability == StateMutability::Payable; }
|
||||||
std::vector<ASTPointer<ModifierInvocation>> const& modifiers() const { return m_functionModifiers; }
|
std::vector<ASTPointer<ModifierInvocation>> const& modifiers() const { return m_functionModifiers; }
|
||||||
@ -661,6 +690,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
StateMutability m_stateMutability;
|
StateMutability m_stateMutability;
|
||||||
bool m_isConstructor;
|
bool m_isConstructor;
|
||||||
|
ASTPointer<OverrideSpecifier> m_overrides;
|
||||||
std::vector<ASTPointer<ModifierInvocation>> m_functionModifiers;
|
std::vector<ASTPointer<ModifierInvocation>> m_functionModifiers;
|
||||||
ASTPointer<Block> m_body;
|
ASTPointer<Block> m_body;
|
||||||
};
|
};
|
||||||
@ -683,6 +713,7 @@ public:
|
|||||||
bool _isStateVar = false,
|
bool _isStateVar = false,
|
||||||
bool _isIndexed = false,
|
bool _isIndexed = false,
|
||||||
bool _isConstant = false,
|
bool _isConstant = false,
|
||||||
|
ASTPointer<OverrideSpecifier> const& _overrides = nullptr,
|
||||||
Location _referenceLocation = Location::Unspecified
|
Location _referenceLocation = Location::Unspecified
|
||||||
):
|
):
|
||||||
Declaration(_sourceLocation, _name, _visibility),
|
Declaration(_sourceLocation, _name, _visibility),
|
||||||
@ -691,6 +722,7 @@ public:
|
|||||||
m_isStateVariable(_isStateVar),
|
m_isStateVariable(_isStateVar),
|
||||||
m_isIndexed(_isIndexed),
|
m_isIndexed(_isIndexed),
|
||||||
m_isConstant(_isConstant),
|
m_isConstant(_isConstant),
|
||||||
|
m_overrides(_overrides),
|
||||||
m_location(_referenceLocation) {}
|
m_location(_referenceLocation) {}
|
||||||
|
|
||||||
void accept(ASTVisitor& _visitor) override;
|
void accept(ASTVisitor& _visitor) override;
|
||||||
@ -730,6 +762,7 @@ public:
|
|||||||
bool isStateVariable() const { return m_isStateVariable; }
|
bool isStateVariable() const { return m_isStateVariable; }
|
||||||
bool isIndexed() const { return m_isIndexed; }
|
bool isIndexed() const { return m_isIndexed; }
|
||||||
bool isConstant() const { return m_isConstant; }
|
bool isConstant() const { return m_isConstant; }
|
||||||
|
ASTPointer<OverrideSpecifier> const& overrides() const { return m_overrides; }
|
||||||
Location referenceLocation() const { return m_location; }
|
Location referenceLocation() const { return m_location; }
|
||||||
/// @returns a set of allowed storage locations for the variable.
|
/// @returns a set of allowed storage locations for the variable.
|
||||||
std::set<Location> allowedDataLocations() const;
|
std::set<Location> allowedDataLocations() const;
|
||||||
@ -753,6 +786,7 @@ private:
|
|||||||
bool m_isStateVariable; ///< Whether or not this is a contract state variable
|
bool m_isStateVariable; ///< Whether or not this is a contract state variable
|
||||||
bool m_isIndexed; ///< Whether this is an indexed variable (used by events).
|
bool m_isIndexed; ///< Whether this is an indexed variable (used by events).
|
||||||
bool m_isConstant; ///< Whether the variable is a compile-time constant.
|
bool m_isConstant; ///< Whether the variable is a compile-time constant.
|
||||||
|
ASTPointer<OverrideSpecifier> m_overrides; ///< Contains the override specifier node
|
||||||
Location m_location; ///< Location of the variable if it is of reference type.
|
Location m_location; ///< Location of the variable if it is of reference type.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class PragmaDirective;
|
|||||||
class ImportDirective;
|
class ImportDirective;
|
||||||
class Declaration;
|
class Declaration;
|
||||||
class CallableDeclaration;
|
class CallableDeclaration;
|
||||||
|
class OverrideSpecifier;
|
||||||
class ContractDefinition;
|
class ContractDefinition;
|
||||||
class InheritanceSpecifier;
|
class InheritanceSpecifier;
|
||||||
class UsingForDirective;
|
class UsingForDirective;
|
||||||
|
@ -334,6 +334,7 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
|
|||||||
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
|
make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
|
||||||
make_pair("superFunction", idOrNull(_node.annotation().superFunction)),
|
make_pair("superFunction", idOrNull(_node.annotation().superFunction)),
|
||||||
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
|
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
|
||||||
|
make_pair("overrides", _node.overrides() ? toJson(_node.overrides()->overrides()) : Json::nullValue),
|
||||||
make_pair("parameters", toJson(_node.parameterList())),
|
make_pair("parameters", toJson(_node.parameterList())),
|
||||||
make_pair("returnParameters", toJson(*_node.returnParameterList())),
|
make_pair("returnParameters", toJson(*_node.returnParameterList())),
|
||||||
make_pair("modifiers", toJson(_node.modifiers())),
|
make_pair("modifiers", toJson(_node.modifiers())),
|
||||||
@ -355,6 +356,7 @@ bool ASTJsonConverter::visit(VariableDeclaration const& _node)
|
|||||||
make_pair("constant", _node.isConstant()),
|
make_pair("constant", _node.isConstant()),
|
||||||
make_pair("stateVariable", _node.isStateVariable()),
|
make_pair("stateVariable", _node.isStateVariable()),
|
||||||
make_pair("storageLocation", location(_node.referenceLocation())),
|
make_pair("storageLocation", location(_node.referenceLocation())),
|
||||||
|
make_pair("overrides", _node.overrides() ? toJson(_node.overrides()->overrides()) : Json::nullValue),
|
||||||
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
|
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
|
||||||
make_pair("value", _node.value() ? toJson(*_node.value()) : Json::nullValue),
|
make_pair("value", _node.value() ? toJson(*_node.value()) : Json::nullValue),
|
||||||
make_pair("scope", idOrNull(_node.scope())),
|
make_pair("scope", idOrNull(_node.scope())),
|
||||||
|
@ -111,6 +111,13 @@ bool ASTPrinter::visit(ParameterList const& _node)
|
|||||||
return goDeeper();
|
return goDeeper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ASTPrinter::visit(OverrideSpecifier const& _node)
|
||||||
|
{
|
||||||
|
writeLine("OverrideSpecifier");
|
||||||
|
printSourcePart(_node);
|
||||||
|
return goDeeper();
|
||||||
|
}
|
||||||
|
|
||||||
bool ASTPrinter::visit(FunctionDefinition const& _node)
|
bool ASTPrinter::visit(FunctionDefinition const& _node)
|
||||||
{
|
{
|
||||||
writeLine(
|
writeLine(
|
||||||
@ -432,6 +439,11 @@ void ASTPrinter::endVisit(ParameterList const&)
|
|||||||
m_indentation--;
|
m_indentation--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASTPrinter::endVisit(OverrideSpecifier const&)
|
||||||
|
{
|
||||||
|
m_indentation--;
|
||||||
|
}
|
||||||
|
|
||||||
void ASTPrinter::endVisit(FunctionDefinition const&)
|
void ASTPrinter::endVisit(FunctionDefinition const&)
|
||||||
{
|
{
|
||||||
m_indentation--;
|
m_indentation--;
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
bool visit(EnumDefinition const& _node) override;
|
bool visit(EnumDefinition const& _node) override;
|
||||||
bool visit(EnumValue const& _node) override;
|
bool visit(EnumValue const& _node) override;
|
||||||
bool visit(ParameterList const& _node) override;
|
bool visit(ParameterList const& _node) override;
|
||||||
|
bool visit(OverrideSpecifier const& _node) override;
|
||||||
bool visit(FunctionDefinition const& _node) override;
|
bool visit(FunctionDefinition const& _node) override;
|
||||||
bool visit(VariableDeclaration const& _node) override;
|
bool visit(VariableDeclaration const& _node) override;
|
||||||
bool visit(ModifierDefinition const& _node) override;
|
bool visit(ModifierDefinition const& _node) override;
|
||||||
@ -101,6 +102,7 @@ public:
|
|||||||
void endVisit(EnumDefinition const&) override;
|
void endVisit(EnumDefinition const&) override;
|
||||||
void endVisit(EnumValue const&) override;
|
void endVisit(EnumValue const&) override;
|
||||||
void endVisit(ParameterList const&) override;
|
void endVisit(ParameterList const&) override;
|
||||||
|
void endVisit(OverrideSpecifier const&) override;
|
||||||
void endVisit(FunctionDefinition const&) override;
|
void endVisit(FunctionDefinition const&) override;
|
||||||
void endVisit(VariableDeclaration const&) override;
|
void endVisit(VariableDeclaration const&) override;
|
||||||
void endVisit(ModifierDefinition const&) override;
|
void endVisit(ModifierDefinition const&) override;
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
virtual bool visit(EnumDefinition& _node) { return visitNode(_node); }
|
virtual bool visit(EnumDefinition& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(EnumValue& _node) { return visitNode(_node); }
|
virtual bool visit(EnumValue& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(ParameterList& _node) { return visitNode(_node); }
|
virtual bool visit(ParameterList& _node) { return visitNode(_node); }
|
||||||
|
virtual bool visit(OverrideSpecifier& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(FunctionDefinition& _node) { return visitNode(_node); }
|
virtual bool visit(FunctionDefinition& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(VariableDeclaration& _node) { return visitNode(_node); }
|
virtual bool visit(VariableDeclaration& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(ModifierDefinition& _node) { return visitNode(_node); }
|
virtual bool visit(ModifierDefinition& _node) { return visitNode(_node); }
|
||||||
@ -100,6 +101,7 @@ public:
|
|||||||
virtual void endVisit(EnumDefinition& _node) { endVisitNode(_node); }
|
virtual void endVisit(EnumDefinition& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(EnumValue& _node) { endVisitNode(_node); }
|
virtual void endVisit(EnumValue& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(ParameterList& _node) { endVisitNode(_node); }
|
virtual void endVisit(ParameterList& _node) { endVisitNode(_node); }
|
||||||
|
virtual void endVisit(OverrideSpecifier& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(FunctionDefinition& _node) { endVisitNode(_node); }
|
virtual void endVisit(FunctionDefinition& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(VariableDeclaration& _node) { endVisitNode(_node); }
|
virtual void endVisit(VariableDeclaration& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(ModifierDefinition& _node) { endVisitNode(_node); }
|
virtual void endVisit(ModifierDefinition& _node) { endVisitNode(_node); }
|
||||||
@ -159,6 +161,7 @@ public:
|
|||||||
virtual bool visit(EnumDefinition const& _node) { return visitNode(_node); }
|
virtual bool visit(EnumDefinition const& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(EnumValue const& _node) { return visitNode(_node); }
|
virtual bool visit(EnumValue const& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(ParameterList const& _node) { return visitNode(_node); }
|
virtual bool visit(ParameterList const& _node) { return visitNode(_node); }
|
||||||
|
virtual bool visit(OverrideSpecifier const& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(FunctionDefinition const& _node) { return visitNode(_node); }
|
virtual bool visit(FunctionDefinition const& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(VariableDeclaration const& _node) { return visitNode(_node); }
|
virtual bool visit(VariableDeclaration const& _node) { return visitNode(_node); }
|
||||||
virtual bool visit(ModifierDefinition const& _node) { return visitNode(_node); }
|
virtual bool visit(ModifierDefinition const& _node) { return visitNode(_node); }
|
||||||
@ -205,6 +208,7 @@ public:
|
|||||||
virtual void endVisit(EnumDefinition const& _node) { endVisitNode(_node); }
|
virtual void endVisit(EnumDefinition const& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(EnumValue const& _node) { endVisitNode(_node); }
|
virtual void endVisit(EnumValue const& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(ParameterList const& _node) { endVisitNode(_node); }
|
virtual void endVisit(ParameterList const& _node) { endVisitNode(_node); }
|
||||||
|
virtual void endVisit(OverrideSpecifier const& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(FunctionDefinition const& _node) { endVisitNode(_node); }
|
virtual void endVisit(FunctionDefinition const& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(VariableDeclaration const& _node) { endVisitNode(_node); }
|
virtual void endVisit(VariableDeclaration const& _node) { endVisitNode(_node); }
|
||||||
virtual void endVisit(ModifierDefinition const& _node) { endVisitNode(_node); }
|
virtual void endVisit(ModifierDefinition const& _node) { endVisitNode(_node); }
|
||||||
|
@ -187,10 +187,26 @@ void ParameterList::accept(ASTConstVisitor& _visitor) const
|
|||||||
_visitor.endVisit(*this);
|
_visitor.endVisit(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverrideSpecifier::accept(ASTVisitor& _visitor)
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
listAccept(m_overrides, _visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OverrideSpecifier::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
listAccept(m_overrides, _visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void FunctionDefinition::accept(ASTVisitor& _visitor)
|
void FunctionDefinition::accept(ASTVisitor& _visitor)
|
||||||
{
|
{
|
||||||
if (_visitor.visit(*this))
|
if (_visitor.visit(*this))
|
||||||
{
|
{
|
||||||
|
if (m_overrides)
|
||||||
|
m_overrides->accept(_visitor);
|
||||||
m_parameters->accept(_visitor);
|
m_parameters->accept(_visitor);
|
||||||
if (m_returnParameters)
|
if (m_returnParameters)
|
||||||
m_returnParameters->accept(_visitor);
|
m_returnParameters->accept(_visitor);
|
||||||
@ -205,6 +221,8 @@ void FunctionDefinition::accept(ASTConstVisitor& _visitor) const
|
|||||||
{
|
{
|
||||||
if (_visitor.visit(*this))
|
if (_visitor.visit(*this))
|
||||||
{
|
{
|
||||||
|
if (m_overrides)
|
||||||
|
m_overrides->accept(_visitor);
|
||||||
m_parameters->accept(_visitor);
|
m_parameters->accept(_visitor);
|
||||||
if (m_returnParameters)
|
if (m_returnParameters)
|
||||||
m_returnParameters->accept(_visitor);
|
m_returnParameters->accept(_visitor);
|
||||||
|
@ -382,6 +382,36 @@ Declaration::Visibility Parser::parseVisibilitySpecifier()
|
|||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASTPointer<OverrideSpecifier> Parser::parseOverrideSpecifier()
|
||||||
|
{
|
||||||
|
solAssert(m_scanner->currentToken() == Token::Override, "");
|
||||||
|
|
||||||
|
ASTNodeFactory nodeFactory(*this);
|
||||||
|
std::vector<ASTPointer<UserDefinedTypeName>> overrides;
|
||||||
|
|
||||||
|
nodeFactory.markEndPosition();
|
||||||
|
m_scanner->next();
|
||||||
|
|
||||||
|
if (m_scanner->currentToken() == Token::LParen)
|
||||||
|
{
|
||||||
|
m_scanner->next();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
overrides.push_back(parseUserDefinedTypeName());
|
||||||
|
|
||||||
|
if (m_scanner->currentToken() == Token::RParen)
|
||||||
|
break;
|
||||||
|
|
||||||
|
expectToken(Token::Comma);
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeFactory.markEndPosition();
|
||||||
|
expectToken(Token::RParen);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodeFactory.createNode<OverrideSpecifier>(move(overrides));
|
||||||
|
}
|
||||||
|
|
||||||
StateMutability Parser::parseStateMutability()
|
StateMutability Parser::parseStateMutability()
|
||||||
{
|
{
|
||||||
StateMutability stateMutability(StateMutability::NonPayable);
|
StateMutability stateMutability(StateMutability::NonPayable);
|
||||||
@ -411,12 +441,13 @@ StateMutability Parser::parseStateMutability()
|
|||||||
return stateMutability;
|
return stateMutability;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyName, bool _allowModifiers)
|
Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _onlyFuncType, bool _allowFuncDef)
|
||||||
{
|
{
|
||||||
RecursionGuard recursionGuard(*this);
|
RecursionGuard recursionGuard(*this);
|
||||||
FunctionHeaderParserResult result;
|
FunctionHeaderParserResult result;
|
||||||
|
|
||||||
result.isConstructor = false;
|
result.isConstructor = false;
|
||||||
|
result.overrides = nullptr;
|
||||||
|
|
||||||
if (m_scanner->currentToken() == Token::Constructor)
|
if (m_scanner->currentToken() == Token::Constructor)
|
||||||
result.isConstructor = true;
|
result.isConstructor = true;
|
||||||
@ -426,7 +457,7 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN
|
|||||||
|
|
||||||
if (result.isConstructor)
|
if (result.isConstructor)
|
||||||
result.name = make_shared<ASTString>();
|
result.name = make_shared<ASTString>();
|
||||||
else if (_forceEmptyName || m_scanner->currentToken() == Token::LParen)
|
else if (_onlyFuncType || m_scanner->currentToken() == Token::LParen)
|
||||||
result.name = make_shared<ASTString>();
|
result.name = make_shared<ASTString>();
|
||||||
else if (m_scanner->currentToken() == Token::Constructor)
|
else if (m_scanner->currentToken() == Token::Constructor)
|
||||||
fatalParserError(string(
|
fatalParserError(string(
|
||||||
@ -443,7 +474,7 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Token token = m_scanner->currentToken();
|
Token token = m_scanner->currentToken();
|
||||||
if (_allowModifiers && token == Token::Identifier)
|
if (_allowFuncDef && token == Token::Identifier)
|
||||||
{
|
{
|
||||||
// If the name is empty (and this is not a constructor),
|
// If the name is empty (and this is not a constructor),
|
||||||
// then this can either be a modifier (fallback function declaration)
|
// then this can either be a modifier (fallback function declaration)
|
||||||
@ -493,6 +524,13 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN
|
|||||||
else
|
else
|
||||||
result.stateMutability = parseStateMutability();
|
result.stateMutability = parseStateMutability();
|
||||||
}
|
}
|
||||||
|
else if (_allowFuncDef && token == Token::Override)
|
||||||
|
{
|
||||||
|
if (result.overrides)
|
||||||
|
parserError("Override already specified.");
|
||||||
|
|
||||||
|
result.overrides = parseOverrideSpecifier();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -521,6 +559,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinitionOrFunctionTypeStateVariable()
|
|||||||
header.isConstructor ||
|
header.isConstructor ||
|
||||||
!header.modifiers.empty() ||
|
!header.modifiers.empty() ||
|
||||||
!header.name->empty() ||
|
!header.name->empty() ||
|
||||||
|
header.overrides ||
|
||||||
m_scanner->currentToken() == Token::Semicolon ||
|
m_scanner->currentToken() == Token::Semicolon ||
|
||||||
m_scanner->currentToken() == Token::LBrace
|
m_scanner->currentToken() == Token::LBrace
|
||||||
)
|
)
|
||||||
@ -540,6 +579,7 @@ ASTPointer<ASTNode> Parser::parseFunctionDefinitionOrFunctionTypeStateVariable()
|
|||||||
header.visibility,
|
header.visibility,
|
||||||
header.stateMutability,
|
header.stateMutability,
|
||||||
header.isConstructor,
|
header.isConstructor,
|
||||||
|
header.overrides,
|
||||||
docstring,
|
docstring,
|
||||||
header.parameters,
|
header.parameters,
|
||||||
header.modifiers,
|
header.modifiers,
|
||||||
@ -637,6 +677,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
|||||||
}
|
}
|
||||||
bool isIndexed = false;
|
bool isIndexed = false;
|
||||||
bool isDeclaredConst = false;
|
bool isDeclaredConst = false;
|
||||||
|
ASTPointer<OverrideSpecifier> overrides = nullptr;
|
||||||
Declaration::Visibility visibility(Declaration::Visibility::Default);
|
Declaration::Visibility visibility(Declaration::Visibility::Default);
|
||||||
VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified;
|
VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified;
|
||||||
ASTPointer<ASTString> identifier;
|
ASTPointer<ASTString> identifier;
|
||||||
@ -659,6 +700,13 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
|||||||
else
|
else
|
||||||
visibility = parseVisibilitySpecifier();
|
visibility = parseVisibilitySpecifier();
|
||||||
}
|
}
|
||||||
|
else if (_options.isStateVariable && token == Token::Override)
|
||||||
|
{
|
||||||
|
if (overrides)
|
||||||
|
parserError("Override already specified.");
|
||||||
|
|
||||||
|
overrides = parseOverrideSpecifier();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_options.allowIndexed && token == Token::Indexed)
|
if (_options.allowIndexed && token == Token::Indexed)
|
||||||
@ -724,6 +772,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
|||||||
_options.isStateVariable,
|
_options.isStateVariable,
|
||||||
isIndexed,
|
isIndexed,
|
||||||
isDeclaredConst,
|
isDeclaredConst,
|
||||||
|
overrides,
|
||||||
location
|
location
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
struct FunctionHeaderParserResult
|
struct FunctionHeaderParserResult
|
||||||
{
|
{
|
||||||
bool isConstructor;
|
bool isConstructor;
|
||||||
|
ASTPointer<OverrideSpecifier> overrides;
|
||||||
ASTPointer<ASTString> name;
|
ASTPointer<ASTString> name;
|
||||||
ASTPointer<ParameterList> parameters;
|
ASTPointer<ParameterList> parameters;
|
||||||
ASTPointer<ParameterList> returnParameters;
|
ASTPointer<ParameterList> returnParameters;
|
||||||
@ -88,8 +89,9 @@ private:
|
|||||||
ASTPointer<ContractDefinition> parseContractDefinition();
|
ASTPointer<ContractDefinition> parseContractDefinition();
|
||||||
ASTPointer<InheritanceSpecifier> parseInheritanceSpecifier();
|
ASTPointer<InheritanceSpecifier> parseInheritanceSpecifier();
|
||||||
Declaration::Visibility parseVisibilitySpecifier();
|
Declaration::Visibility parseVisibilitySpecifier();
|
||||||
|
ASTPointer<OverrideSpecifier> parseOverrideSpecifier();
|
||||||
StateMutability parseStateMutability();
|
StateMutability parseStateMutability();
|
||||||
FunctionHeaderParserResult parseFunctionHeader(bool _forceEmptyName, bool _allowModifiers);
|
FunctionHeaderParserResult parseFunctionHeader(bool _onlyFuncType, bool _allowFuncDef);
|
||||||
ASTPointer<ASTNode> parseFunctionDefinitionOrFunctionTypeStateVariable();
|
ASTPointer<ASTNode> parseFunctionDefinitionOrFunctionTypeStateVariable();
|
||||||
ASTPointer<FunctionDefinition> parseFunctionDefinition(ASTString const* _contractName);
|
ASTPointer<FunctionDefinition> parseFunctionDefinition(ASTString const* _contractName);
|
||||||
ASTPointer<StructDefinition> parseStructDefinition();
|
ASTPointer<StructDefinition> parseStructDefinition();
|
||||||
|
@ -1 +1 @@
|
|||||||
{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"61:2:0","statements":[]},"documentation":null,"id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"46:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"61:0:0"},"scope":6,"src":"36:27:0","stateMutability":"pure","superFunction":null,"visibility":"public"}],"scope":7,"src":"23:42:0"}],"src":"0:65:0"},"id":0}}}
|
{"sources":{"A":{"ast":{"absolutePath":"A","exportedSymbols":{"C":[6]},"id":7,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"0:22:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":6,"linearizedBaseContracts":[6],"name":"C","nodeType":"ContractDefinition","nodes":[{"body":{"id":4,"nodeType":"Block","src":"61:2:0","statements":[]},"documentation":null,"id":5,"implemented":true,"kind":"function","modifiers":[],"name":"f","nodeType":"FunctionDefinition","overrides":null,"parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"46:2:0"},"returnParameters":{"id":3,"nodeType":"ParameterList","parameters":[],"src":"61:0:0"},"scope":6,"src":"36:27:0","stateMutability":"pure","superFunction":null,"visibility":"public"}],"scope":7,"src":"23:42:0"}],"src":"0:65:0"},"id":0}}}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"id" : 4,
|
"id" : 4,
|
||||||
"name" : "m",
|
"name" : "m",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 37,
|
"scope" : 37,
|
||||||
"src" : "17:44:1",
|
"src" : "17:44:1",
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
@ -99,6 +100,7 @@
|
|||||||
"id" : 12,
|
"id" : 12,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 35,
|
"scope" : 35,
|
||||||
"src" : "144:17:1",
|
"src" : "144:17:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -239,6 +241,7 @@
|
|||||||
"id" : 22,
|
"id" : 22,
|
||||||
"name" : "c",
|
"name" : "c",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 35,
|
"scope" : 35,
|
||||||
"src" : "197:9:1",
|
"src" : "197:9:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -467,6 +470,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 7,
|
"id" : 7,
|
||||||
@ -478,6 +482,7 @@
|
|||||||
"id" : 6,
|
"id" : 6,
|
||||||
"name" : "arg",
|
"name" : "arg",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 36,
|
"scope" : 36,
|
||||||
"src" : "78:19:1",
|
"src" : "78:19:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -517,6 +522,7 @@
|
|||||||
"id" : 9,
|
"id" : 9,
|
||||||
"name" : "r",
|
"name" : "r",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 36,
|
"scope" : 36,
|
||||||
"src" : "115:17:1",
|
"src" : "115:17:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "m",
|
"name" : "m",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 37,
|
"scope" : 37,
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -99,6 +100,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 37,
|
"scope" : 37,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -114,6 +116,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "arg",
|
"name" : "arg",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 36,
|
"scope" : 36,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -152,6 +155,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "r",
|
"name" : "r",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 36,
|
"scope" : 36,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -200,6 +204,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 35,
|
"scope" : 35,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -352,6 +357,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "c",
|
"name" : "c",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 35,
|
"scope" : 35,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 4,
|
"scope" : 4,
|
||||||
"src" : "13:8:1",
|
"src" : "13:8:1",
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract C { uint[] i; }
|
contract C { uint[] i; }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 4,
|
"scope" : 4,
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -2,3 +2,5 @@ contract C {
|
|||||||
constructor() public {
|
constructor() public {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 5,
|
"scope" : 5,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "fn",
|
"name" : "fn",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 11,
|
"id" : 11,
|
||||||
|
@ -15,3 +15,5 @@ contract C {
|
|||||||
/** Some comment on mod.*/ modifier mod() { _; }
|
/** Some comment on mod.*/ modifier mod() { _; }
|
||||||
/** Some comment on fn.*/ function fn() public {}
|
/** Some comment on fn.*/ function fn() public {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "fn",
|
"name" : "fn",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 15,
|
"scope" : 15,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -2,3 +2,5 @@ contract C {
|
|||||||
function() external payable {
|
function() external payable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 5,
|
"scope" : 5,
|
||||||
"stateMutability" : "payable",
|
"stateMutability" : "payable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
contract C {
|
contract C {
|
||||||
function() external {}
|
function() external {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 5,
|
"scope" : 5,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 7,
|
"id" : 7,
|
||||||
@ -52,6 +53,7 @@
|
|||||||
"id" : 6,
|
"id" : 6,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 16,
|
"scope" : 16,
|
||||||
"src" : "24:44:1",
|
"src" : "24:44:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -83,6 +85,7 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 5,
|
"scope" : 5,
|
||||||
"src" : "61:4:1",
|
"src" : "61:4:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -136,6 +139,7 @@
|
|||||||
"id" : 13,
|
"id" : 13,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 16,
|
"scope" : 16,
|
||||||
"src" : "79:40:1",
|
"src" : "79:40:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -167,6 +171,7 @@
|
|||||||
"id" : 10,
|
"id" : 10,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 12,
|
"scope" : 12,
|
||||||
"src" : "113:4:1",
|
"src" : "113:4:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 17,
|
"scope" : 17,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -62,6 +63,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 16,
|
"scope" : 16,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -101,6 +103,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 5,
|
"scope" : 5,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -153,6 +156,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 16,
|
"scope" : 16,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -192,6 +196,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "",
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 12,
|
"scope" : 12,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"id" : 4,
|
"id" : 4,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"src" : "35:6:1",
|
"src" : "35:6:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -146,6 +147,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract c { function f() public { uint a = 2 + 3; } }
|
contract c { function f() public { uint a = 2 + 3; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 11,
|
"scope" : 11,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -98,6 +99,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 14,
|
"scope" : 14,
|
||||||
"src" : "13:8:1",
|
"src" : "13:8:1",
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
@ -87,6 +88,7 @@
|
|||||||
"id" : 9,
|
"id" : 9,
|
||||||
"name" : "b",
|
"name" : "b",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 12,
|
"scope" : 12,
|
||||||
"src" : "45:16:1",
|
"src" : "45:16:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -152,6 +154,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 4,
|
"id" : 4,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract c { uint[] a; function f() public { uint[] storage b = a; } }
|
contract c { uint[] a; function f() public { uint[] storage b = a; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "a",
|
"name" : "a",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 14,
|
"scope" : 14,
|
||||||
"stateVariable" : true,
|
"stateVariable" : true,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -89,6 +90,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 14,
|
"scope" : 14,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -140,6 +142,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "b",
|
"name" : "b",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 12,
|
"scope" : 12,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "storage",
|
"storageLocation" : "storage",
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
"id" : 2,
|
"id" : 2,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"src" : "24:6:1",
|
"src" : "24:6:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -145,6 +146,7 @@
|
|||||||
],
|
],
|
||||||
"name" : "F",
|
"name" : "F",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 7,
|
"id" : 7,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract C { modifier M(uint i) { _; } function F() M(1) public {} }
|
contract C { modifier M(uint i) { _; } function F() M(1) public {} }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -107,6 +108,7 @@
|
|||||||
"isConstructor" : false,
|
"isConstructor" : false,
|
||||||
"kind" : "function",
|
"kind" : "function",
|
||||||
"name" : "F",
|
"name" : "F",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 14,
|
"scope" : 14,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
"id" : 2,
|
"id" : 2,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"src" : "24:6:1",
|
"src" : "24:6:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -145,6 +146,7 @@
|
|||||||
],
|
],
|
||||||
"name" : "F",
|
"name" : "F",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 7,
|
"id" : 7,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract C { modifier M(uint i) { _; } function F() M(1) public {} }
|
contract C { modifier M(uint i) { _; } function F() M(1) public {} }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "i",
|
"name" : "i",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
@ -107,6 +108,7 @@
|
|||||||
"isConstructor" : false,
|
"isConstructor" : false,
|
||||||
"kind" : "function",
|
"kind" : "function",
|
||||||
"name" : "F",
|
"name" : "F",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 14,
|
"scope" : 14,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"src" : "35:5:1",
|
"src" : "35:5:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -93,6 +94,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract C { function f() public { var x = hex"ff"; } }
|
contract C { function f() public { var x = hex"ff"; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 8,
|
"scope" : 8,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -98,6 +99,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 6,
|
"scope" : 6,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
337
test/libsolidity/ASTJSON/override.json
Normal file
337
test/libsolidity/ASTJSON/override.json
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
{
|
||||||
|
"absolutePath" : "a",
|
||||||
|
"exportedSymbols" :
|
||||||
|
{
|
||||||
|
"A" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"B" :
|
||||||
|
[
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"C" :
|
||||||
|
[
|
||||||
|
31
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"id" : 32,
|
||||||
|
"nodeType" : "SourceUnit",
|
||||||
|
"nodes" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"baseContracts" : [],
|
||||||
|
"contractDependencies" : [],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : true,
|
||||||
|
"id" : 5,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "A",
|
||||||
|
"nodeType" : "ContractDefinition",
|
||||||
|
"nodes" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body" :
|
||||||
|
{
|
||||||
|
"id" : 3,
|
||||||
|
"nodeType" : "Block",
|
||||||
|
"src" : "36:2:1",
|
||||||
|
"statements" : []
|
||||||
|
},
|
||||||
|
"documentation" : null,
|
||||||
|
"id" : 4,
|
||||||
|
"implemented" : true,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" : [],
|
||||||
|
"name" : "faa",
|
||||||
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
|
"parameters" :
|
||||||
|
{
|
||||||
|
"id" : 1,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "26:2:1"
|
||||||
|
},
|
||||||
|
"returnParameters" :
|
||||||
|
{
|
||||||
|
"id" : 2,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "36:0:1"
|
||||||
|
},
|
||||||
|
"scope" : 5,
|
||||||
|
"src" : "14:24:1",
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scope" : 32,
|
||||||
|
"src" : "0:40:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"baseContracts" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments" : null,
|
||||||
|
"baseName" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"id" : 6,
|
||||||
|
"name" : "A",
|
||||||
|
"nodeType" : "UserDefinedTypeName",
|
||||||
|
"referencedDeclaration" : 5,
|
||||||
|
"src" : "55:1:1",
|
||||||
|
"typeDescriptions" :
|
||||||
|
{
|
||||||
|
"typeIdentifier" : "t_contract$_A_$5",
|
||||||
|
"typeString" : "contract A"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id" : 7,
|
||||||
|
"nodeType" : "InheritanceSpecifier",
|
||||||
|
"src" : "55:1:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : false,
|
||||||
|
"id" : 16,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
16,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "B",
|
||||||
|
"nodeType" : "ContractDefinition",
|
||||||
|
"nodes" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body" : null,
|
||||||
|
"documentation" : null,
|
||||||
|
"id" : 10,
|
||||||
|
"implemented" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" : [],
|
||||||
|
"name" : "foo",
|
||||||
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
|
"parameters" :
|
||||||
|
{
|
||||||
|
"id" : 8,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "72:2:1"
|
||||||
|
},
|
||||||
|
"returnParameters" :
|
||||||
|
{
|
||||||
|
"id" : 9,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "81:0:1"
|
||||||
|
},
|
||||||
|
"scope" : 16,
|
||||||
|
"src" : "60:22:1",
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body" :
|
||||||
|
{
|
||||||
|
"id" : 14,
|
||||||
|
"nodeType" : "Block",
|
||||||
|
"src" : "115:2:1",
|
||||||
|
"statements" : []
|
||||||
|
},
|
||||||
|
"documentation" : null,
|
||||||
|
"id" : 15,
|
||||||
|
"implemented" : true,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" : [],
|
||||||
|
"name" : "faa",
|
||||||
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : [],
|
||||||
|
"parameters" :
|
||||||
|
{
|
||||||
|
"id" : 11,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "96:2:1"
|
||||||
|
},
|
||||||
|
"returnParameters" :
|
||||||
|
{
|
||||||
|
"id" : 13,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "115:0:1"
|
||||||
|
},
|
||||||
|
"scope" : 16,
|
||||||
|
"src" : "84:33:1",
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 4,
|
||||||
|
"visibility" : "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scope" : 32,
|
||||||
|
"src" : "41:78:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"baseContracts" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments" : null,
|
||||||
|
"baseName" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"id" : 17,
|
||||||
|
"name" : "B",
|
||||||
|
"nodeType" : "UserDefinedTypeName",
|
||||||
|
"referencedDeclaration" : 16,
|
||||||
|
"src" : "134:1:1",
|
||||||
|
"typeDescriptions" :
|
||||||
|
{
|
||||||
|
"typeIdentifier" : "t_contract$_B_$16",
|
||||||
|
"typeString" : "contract B"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id" : 18,
|
||||||
|
"nodeType" : "InheritanceSpecifier",
|
||||||
|
"src" : "134:1:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : true,
|
||||||
|
"id" : 31,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
31,
|
||||||
|
16,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "C",
|
||||||
|
"nodeType" : "ContractDefinition",
|
||||||
|
"nodes" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"body" :
|
||||||
|
{
|
||||||
|
"id" : 22,
|
||||||
|
"nodeType" : "Block",
|
||||||
|
"src" : "170:3:1",
|
||||||
|
"statements" : []
|
||||||
|
},
|
||||||
|
"documentation" : null,
|
||||||
|
"id" : 23,
|
||||||
|
"implemented" : true,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" : [],
|
||||||
|
"name" : "foo",
|
||||||
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : [],
|
||||||
|
"parameters" :
|
||||||
|
{
|
||||||
|
"id" : 19,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "151:2:1"
|
||||||
|
},
|
||||||
|
"returnParameters" :
|
||||||
|
{
|
||||||
|
"id" : 21,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "170:0:1"
|
||||||
|
},
|
||||||
|
"scope" : 31,
|
||||||
|
"src" : "139:34:1",
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 10,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"body" :
|
||||||
|
{
|
||||||
|
"id" : 29,
|
||||||
|
"nodeType" : "Block",
|
||||||
|
"src" : "212:2:1",
|
||||||
|
"statements" : []
|
||||||
|
},
|
||||||
|
"documentation" : null,
|
||||||
|
"id" : 30,
|
||||||
|
"implemented" : true,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" : [],
|
||||||
|
"name" : "faa",
|
||||||
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"id" : 25,
|
||||||
|
"name" : "A",
|
||||||
|
"nodeType" : "UserDefinedTypeName",
|
||||||
|
"referencedDeclaration" : 5,
|
||||||
|
"src" : "206:1:1",
|
||||||
|
"typeDescriptions" :
|
||||||
|
{
|
||||||
|
"typeIdentifier" : "t_contract$_A_$5",
|
||||||
|
"typeString" : "contract A"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"id" : 26,
|
||||||
|
"name" : "B",
|
||||||
|
"nodeType" : "UserDefinedTypeName",
|
||||||
|
"referencedDeclaration" : 16,
|
||||||
|
"src" : "209:1:1",
|
||||||
|
"typeDescriptions" :
|
||||||
|
{
|
||||||
|
"typeIdentifier" : "t_contract$_B_$16",
|
||||||
|
"typeString" : "contract B"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters" :
|
||||||
|
{
|
||||||
|
"id" : 24,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "187:2:1"
|
||||||
|
},
|
||||||
|
"returnParameters" :
|
||||||
|
{
|
||||||
|
"id" : 28,
|
||||||
|
"nodeType" : "ParameterList",
|
||||||
|
"parameters" : [],
|
||||||
|
"src" : "212:0:1"
|
||||||
|
},
|
||||||
|
"scope" : 31,
|
||||||
|
"src" : "175:39:1",
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 15,
|
||||||
|
"visibility" : "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scope" : 32,
|
||||||
|
"src" : "120:96:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"src" : "0:217:1"
|
||||||
|
}
|
13
test/libsolidity/ASTJSON/override.sol
Normal file
13
test/libsolidity/ASTJSON/override.sol
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
contract A {
|
||||||
|
function faa() public {}
|
||||||
|
}
|
||||||
|
contract B is A {
|
||||||
|
function foo() public;
|
||||||
|
function faa() public override {}
|
||||||
|
}
|
||||||
|
contract C is B {
|
||||||
|
function foo() public override { }
|
||||||
|
function faa() public override(A, B) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----
|
492
test/libsolidity/ASTJSON/override_legacy.json
Normal file
492
test/libsolidity/ASTJSON/override_legacy.json
Normal file
@ -0,0 +1,492 @@
|
|||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"absolutePath" : "a",
|
||||||
|
"exportedSymbols" :
|
||||||
|
{
|
||||||
|
"A" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"B" :
|
||||||
|
[
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"C" :
|
||||||
|
[
|
||||||
|
31
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"baseContracts" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : true,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "A",
|
||||||
|
"scope" : 32
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "faa",
|
||||||
|
"overrides" : null,
|
||||||
|
"scope" : 5,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 1,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "26:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 2,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "36:0:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"statements" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 3,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "36:2:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 4,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "14:24:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 5,
|
||||||
|
"name" : "ContractDefinition",
|
||||||
|
"src" : "0:40:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : false,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
16,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "B",
|
||||||
|
"scope" : 32
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"arguments" : null
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"name" : "A",
|
||||||
|
"referencedDeclaration" : 5,
|
||||||
|
"type" : "contract A"
|
||||||
|
},
|
||||||
|
"id" : 6,
|
||||||
|
"name" : "UserDefinedTypeName",
|
||||||
|
"src" : "55:1:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 7,
|
||||||
|
"name" : "InheritanceSpecifier",
|
||||||
|
"src" : "55:1:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"body" : null,
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : false,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "foo",
|
||||||
|
"overrides" : null,
|
||||||
|
"scope" : 16,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 8,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "72:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 9,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "81:0:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 10,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "60:22:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "faa",
|
||||||
|
"overrides" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"scope" : 16,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 4,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 11,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "96:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 13,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "115:0:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"statements" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 14,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "115:2:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 15,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "84:33:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 16,
|
||||||
|
"name" : "ContractDefinition",
|
||||||
|
"src" : "41:78:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : true,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
31,
|
||||||
|
16,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"name" : "C",
|
||||||
|
"scope" : 32
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"arguments" : null
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"name" : "B",
|
||||||
|
"referencedDeclaration" : 16,
|
||||||
|
"type" : "contract B"
|
||||||
|
},
|
||||||
|
"id" : 17,
|
||||||
|
"name" : "UserDefinedTypeName",
|
||||||
|
"src" : "134:1:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 18,
|
||||||
|
"name" : "InheritanceSpecifier",
|
||||||
|
"src" : "134:1:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "foo",
|
||||||
|
"overrides" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"scope" : 31,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 10,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 19,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "151:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 21,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "170:0:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"statements" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 22,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "170:3:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 23,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "139:34:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "faa",
|
||||||
|
"scope" : 31,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : 15,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"name" : "A",
|
||||||
|
"referencedDeclaration" : 5,
|
||||||
|
"type" : "contract A"
|
||||||
|
},
|
||||||
|
"id" : 25,
|
||||||
|
"name" : "UserDefinedTypeName",
|
||||||
|
"src" : "206:1:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"contractScope" : null,
|
||||||
|
"name" : "B",
|
||||||
|
"referencedDeclaration" : 16,
|
||||||
|
"type" : "contract B"
|
||||||
|
},
|
||||||
|
"id" : 26,
|
||||||
|
"name" : "UserDefinedTypeName",
|
||||||
|
"src" : "209:1:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 24,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "187:2:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 28,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "212:0:1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"statements" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 29,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "212:2:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 30,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "175:39:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 31,
|
||||||
|
"name" : "ContractDefinition",
|
||||||
|
"src" : "120:96:1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 32,
|
||||||
|
"name" : "SourceUnit",
|
||||||
|
"src" : "0:217:1"
|
||||||
|
}
|
@ -46,6 +46,7 @@
|
|||||||
"id" : 6,
|
"id" : 6,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 8,
|
"scope" : 8,
|
||||||
"src" : "35:15:1",
|
"src" : "35:15:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -97,6 +98,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract c { function f() public { uint[] memory x; } }
|
contract c { function f() public { uint[] memory x; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 10,
|
"scope" : 10,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -99,6 +100,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 8,
|
"scope" : 8,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "memory",
|
"storageLocation" : "memory",
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"id" : 7,
|
"id" : 7,
|
||||||
"name" : "rows",
|
"name" : "rows",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"src" : "35:20:1",
|
"src" : "35:20:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -109,6 +110,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract c { function f() public { uint[][] memory rows; } }
|
contract c { function f() public { uint[][] memory rows; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 11,
|
"scope" : 11,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -99,6 +100,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "rows",
|
"name" : "rows",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "memory",
|
"storageLocation" : "memory",
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"id" : 3,
|
"id" : 3,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
"nodeType" : "VariableDeclaration",
|
"nodeType" : "VariableDeclaration",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"src" : "28:5:1",
|
"src" : "28:5:1",
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
@ -131,6 +132,7 @@
|
|||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
"nodeType" : "FunctionDefinition",
|
"nodeType" : "FunctionDefinition",
|
||||||
|
"overrides" : null,
|
||||||
"parameters" :
|
"parameters" :
|
||||||
{
|
{
|
||||||
"id" : 1,
|
"id" : 1,
|
||||||
|
@ -1 +1,3 @@
|
|||||||
contract C { function f() { var x = 2; x++; } }
|
contract C { function f() { var x = 2; x++; } }
|
||||||
|
|
||||||
|
// ----
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
"name" : "f",
|
"name" : "f",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 11,
|
"scope" : 11,
|
||||||
"stateMutability" : "nonpayable",
|
"stateMutability" : "nonpayable",
|
||||||
"superFunction" : null,
|
"superFunction" : null,
|
||||||
@ -98,6 +99,7 @@
|
|||||||
{
|
{
|
||||||
"constant" : false,
|
"constant" : false,
|
||||||
"name" : "x",
|
"name" : "x",
|
||||||
|
"overrides" : null,
|
||||||
"scope" : 9,
|
"scope" : 9,
|
||||||
"stateVariable" : false,
|
"stateVariable" : false,
|
||||||
"storageLocation" : "default",
|
"storageLocation" : "default",
|
||||||
|
@ -545,7 +545,6 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
|||||||
"mutable",
|
"mutable",
|
||||||
"null",
|
"null",
|
||||||
"of",
|
"of",
|
||||||
"override",
|
|
||||||
"partial",
|
"partial",
|
||||||
"promise",
|
"promise",
|
||||||
"reference",
|
"reference",
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
contract X {
|
||||||
|
int public override override testvar;
|
||||||
|
function test() internal override override returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (34-42): Override already specified.
|
||||||
|
// ParserError: (87-95): Override already specified.
|
@ -0,0 +1,5 @@
|
|||||||
|
contract X {
|
||||||
|
int public override testvar;
|
||||||
|
function test() internal override returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
@ -0,0 +1,10 @@
|
|||||||
|
contract A {
|
||||||
|
int public testvar;
|
||||||
|
function test() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X is A {
|
||||||
|
int public override testvar;
|
||||||
|
function test() internal override() returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (164-165): Expected identifier but got ')'
|
@ -0,0 +1,9 @@
|
|||||||
|
contract A {
|
||||||
|
function foo() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X {
|
||||||
|
int public override testvar;
|
||||||
|
function test() internal override returns (uint256);
|
||||||
|
function foo() internal override(X, A) returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
@ -0,0 +1,8 @@
|
|||||||
|
contract A {
|
||||||
|
function foo() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X {
|
||||||
|
int public override(A,) testvar;
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (95-96): Expected identifier but got ')'
|
@ -0,0 +1,8 @@
|
|||||||
|
contract A {
|
||||||
|
function foo() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X {
|
||||||
|
function test() internal override(,) returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (107-108): Expected identifier but got ','
|
@ -0,0 +1,8 @@
|
|||||||
|
contract A {
|
||||||
|
function foo() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X {
|
||||||
|
function foo() internal override(X, address) returns (uint256);
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (109-116): Expected identifier but got 'address'
|
@ -0,0 +1,8 @@
|
|||||||
|
contract A {
|
||||||
|
function foo() internal returns (uint256);
|
||||||
|
}
|
||||||
|
contract X {
|
||||||
|
int public override() testvar;
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// ParserError: (93-94): Expected identifier but got ')'
|
Loading…
Reference in New Issue
Block a user