mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7372 from ethereum/removeAstPrinter
Remove ASTPrinter.
This commit is contained in:
commit
10830d2401
@ -1,6 +1,7 @@
|
|||||||
### 0.6.0 (unreleased)
|
### 0.6.0 (unreleased)
|
||||||
|
|
||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
* Commandline interface: remove the text-based ast printer (``--ast``).
|
||||||
* General: Disallow explicit conversions from external function types to ``address`` and add a member called ``address`` to them as replacement.
|
* General: Disallow explicit conversions from external function types to ``address`` and add a member called ``address`` to them as replacement.
|
||||||
* Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
|
* Type checker: Resulting type of exponentiation is equal to the type of the base. Also allow signed types for the base.
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Using the Commandline Compiler
|
|||||||
|
|
||||||
One of the build targets of the Solidity repository is ``solc``, the solidity commandline compiler.
|
One of the build targets of the Solidity repository is ``solc``, the solidity commandline compiler.
|
||||||
Using ``solc --help`` provides you with an explanation of all options. The compiler can produce various outputs, ranging from simple binaries and assembly over an abstract syntax tree (parse tree) to estimations of gas usage.
|
Using ``solc --help`` provides you with an explanation of all options. The compiler can produce various outputs, ranging from simple binaries and assembly over an abstract syntax tree (parse tree) to estimations of gas usage.
|
||||||
If you only want to compile a single file, you run it as ``solc --bin sourceFile.sol`` and it will print the binary. If you want to get some of the more advanced output variants of ``solc``, it is probably better to tell it to output everything to separate files using ``solc -o outputDirectory --bin --ast --asm sourceFile.sol``.
|
If you only want to compile a single file, you run it as ``solc --bin sourceFile.sol`` and it will print the binary. If you want to get some of the more advanced output variants of ``solc``, it is probably better to tell it to output everything to separate files using ``solc -o outputDirectory --bin --ast-json --asm sourceFile.sol``.
|
||||||
|
|
||||||
Before you deploy your contract, activate the optimizer when compiling using ``solc --optimize --bin sourceFile.sol``.
|
Before you deploy your contract, activate the optimizer when compiling using ``solc --optimize --bin sourceFile.sol``.
|
||||||
By default, the optimizer will optimize the contract assuming it is called 200 times across its lifetime
|
By default, the optimizer will optimize the contract assuming it is called 200 times across its lifetime
|
||||||
|
@ -39,8 +39,6 @@ set(sources
|
|||||||
ast/ASTForward.h
|
ast/ASTForward.h
|
||||||
ast/ASTJsonConverter.cpp
|
ast/ASTJsonConverter.cpp
|
||||||
ast/ASTJsonConverter.h
|
ast/ASTJsonConverter.h
|
||||||
ast/ASTPrinter.cpp
|
|
||||||
ast/ASTPrinter.h
|
|
||||||
ast/ASTVisitor.h
|
ast/ASTVisitor.h
|
||||||
ast/ExperimentalFeatures.h
|
ast/ExperimentalFeatures.h
|
||||||
ast/Types.cpp
|
ast/Types.cpp
|
||||||
|
@ -1,656 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of solidity.
|
|
||||||
|
|
||||||
solidity is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
solidity is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @author Christian <c@ethdev.com>
|
|
||||||
* @date 2014
|
|
||||||
* Pretty-printer for the abstract syntax tree (the "pretty" is arguable), used for debugging.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <libsolidity/ast/ASTPrinter.h>
|
|
||||||
|
|
||||||
#include <libsolidity/ast/AST.h>
|
|
||||||
#include <boost/algorithm/string/join.hpp>
|
|
||||||
#include <json/json.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace langutil;
|
|
||||||
|
|
||||||
namespace dev
|
|
||||||
{
|
|
||||||
namespace solidity
|
|
||||||
{
|
|
||||||
|
|
||||||
ASTPrinter::ASTPrinter(
|
|
||||||
ASTNode const& _ast,
|
|
||||||
string const& _source,
|
|
||||||
GasEstimator::ASTGasConsumption const& _gasCosts
|
|
||||||
): m_indentation(0), m_source(_source), m_ast(&_ast), m_gasCosts(_gasCosts)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::print(ostream& _stream)
|
|
||||||
{
|
|
||||||
m_ostream = &_stream;
|
|
||||||
m_ast->accept(*this);
|
|
||||||
m_ostream = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(PragmaDirective const& _node)
|
|
||||||
{
|
|
||||||
writeLine("PragmaDirective");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ImportDirective const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ImportDirective \"" + _node.path() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ContractDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ContractDefinition \"" + _node.name() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(InheritanceSpecifier const& _node)
|
|
||||||
{
|
|
||||||
writeLine("InheritanceSpecifier");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(UsingForDirective const& _node)
|
|
||||||
{
|
|
||||||
writeLine("UsingForDirective");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(StructDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine("StructDefinition \"" + _node.name() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(EnumDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine("EnumDefinition \"" + _node.name() + "\"");
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(EnumValue const& _node)
|
|
||||||
{
|
|
||||||
writeLine("EnumValue \"" + _node.name() + "\"");
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ParameterList const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ParameterList");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(OverrideSpecifier const& _node)
|
|
||||||
{
|
|
||||||
writeLine("OverrideSpecifier");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(FunctionDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine(
|
|
||||||
"FunctionDefinition \"" +
|
|
||||||
_node.name() +
|
|
||||||
"\"" +
|
|
||||||
(_node.isPublic() ? " - public" : "") +
|
|
||||||
(_node.stateMutability() == StateMutability::View ? " - const" : "")
|
|
||||||
);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(VariableDeclaration const& _node)
|
|
||||||
{
|
|
||||||
writeLine("VariableDeclaration \"" + _node.name() + "\"");
|
|
||||||
*m_ostream << indentation() << (
|
|
||||||
_node.annotation().type ?
|
|
||||||
string(" Type: ") + _node.annotation().type->toString() :
|
|
||||||
string(" Type unknown.")
|
|
||||||
) << "\n";
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ModifierDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ModifierDefinition \"" + _node.name() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ModifierInvocation const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ModifierInvocation \"" + _node.name()->name() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(EventDefinition const& _node)
|
|
||||||
{
|
|
||||||
writeLine("EventDefinition \"" + _node.name() + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ElementaryTypeName const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("ElementaryTypeName ") + _node.typeName().toString());
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(UserDefinedTypeName const& _node)
|
|
||||||
{
|
|
||||||
writeLine("UserDefinedTypeName \"" + boost::algorithm::join(_node.namePath(), ".") + "\"");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(FunctionTypeName const& _node)
|
|
||||||
{
|
|
||||||
writeLine("FunctionTypeName");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Mapping const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Mapping");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ArrayTypeName const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ArrayTypeName");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(InlineAssembly const& _node)
|
|
||||||
{
|
|
||||||
writeLine("InlineAssembly");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Block const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Block");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(PlaceholderStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("PlaceholderStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(IfStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("IfStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(WhileStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine(_node.isDoWhile() ? "DoWhileStatement" : "WhileStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ForStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ForStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Continue const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Continue");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Break const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Break");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Return const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Return");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Throw const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Throw");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(EmitStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("EmitStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(VariableDeclarationStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("VariableDeclarationStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ExpressionStatement const& _node)
|
|
||||||
{
|
|
||||||
writeLine("ExpressionStatement");
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Conditional const& _node)
|
|
||||||
{
|
|
||||||
writeLine("Conditional");
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Assignment const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("Assignment using operator ") + TokenTraits::toString(_node.assignmentOperator()));
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(TupleExpression const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("TupleExpression"));
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(UnaryOperation const& _node)
|
|
||||||
{
|
|
||||||
writeLine(
|
|
||||||
string("UnaryOperation (") +
|
|
||||||
(_node.isPrefixOperation() ? "prefix" : "postfix") +
|
|
||||||
") " +
|
|
||||||
TokenTraits::toString(_node.getOperator())
|
|
||||||
);
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(BinaryOperation const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("BinaryOperation using operator ") + TokenTraits::toString(_node.getOperator()));
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(FunctionCall const& _node)
|
|
||||||
{
|
|
||||||
writeLine("FunctionCall");
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(NewExpression const& _node)
|
|
||||||
{
|
|
||||||
writeLine("NewExpression");
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(MemberAccess const& _node)
|
|
||||||
{
|
|
||||||
writeLine("MemberAccess to member " + _node.memberName());
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(IndexAccess const& _node)
|
|
||||||
{
|
|
||||||
writeLine("IndexAccess");
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Identifier const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("Identifier ") + _node.name());
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(ElementaryTypeNameExpression const& _node)
|
|
||||||
{
|
|
||||||
writeLine(string("ElementaryTypeNameExpression ") + _node.typeName().toString());
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ASTPrinter::visit(Literal const& _node)
|
|
||||||
{
|
|
||||||
char const* tokenString = TokenTraits::toString(_node.token());
|
|
||||||
if (!tokenString)
|
|
||||||
tokenString = "[no token]";
|
|
||||||
writeLine(string("Literal, token: ") + tokenString + " value: " + _node.value());
|
|
||||||
printType(_node);
|
|
||||||
printSourcePart(_node);
|
|
||||||
return goDeeper();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(PragmaDirective const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ImportDirective const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ContractDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(InheritanceSpecifier const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(UsingForDirective const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(StructDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(EnumDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(EnumValue const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ParameterList const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(OverrideSpecifier const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(FunctionDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(VariableDeclaration const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ModifierDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ModifierInvocation const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(EventDefinition const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ElementaryTypeName const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(UserDefinedTypeName const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(FunctionTypeName const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Mapping const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ArrayTypeName const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(InlineAssembly const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Block const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(PlaceholderStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(IfStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(WhileStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ForStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Continue const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Break const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Return const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Throw const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(EmitStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(VariableDeclarationStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ExpressionStatement const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Conditional const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Assignment const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(TupleExpression const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(UnaryOperation const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(BinaryOperation const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(FunctionCall const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(NewExpression const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(MemberAccess const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(IndexAccess const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Identifier const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(ElementaryTypeNameExpression const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::endVisit(Literal const&)
|
|
||||||
{
|
|
||||||
m_indentation--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::printSourcePart(ASTNode const& _node)
|
|
||||||
{
|
|
||||||
if (m_gasCosts.count(&_node))
|
|
||||||
*m_ostream << indentation() << " Gas costs: " << m_gasCosts.at(&_node) << endl;
|
|
||||||
if (!m_source.empty())
|
|
||||||
{
|
|
||||||
SourceLocation const& location(_node.location());
|
|
||||||
*m_ostream <<
|
|
||||||
indentation() <<
|
|
||||||
" Source: " <<
|
|
||||||
Json::valueToQuotedString(m_source.substr(location.start, location.end - location.start).c_str()) <<
|
|
||||||
endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::printType(Expression const& _expression)
|
|
||||||
{
|
|
||||||
if (_expression.annotation().type)
|
|
||||||
*m_ostream << indentation() << " Type: " << _expression.annotation().type->toString() << "\n";
|
|
||||||
else
|
|
||||||
*m_ostream << indentation() << " Type unknown.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
string ASTPrinter::indentation() const
|
|
||||||
{
|
|
||||||
return string(m_indentation * 2, ' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
void ASTPrinter::writeLine(string const& _line)
|
|
||||||
{
|
|
||||||
*m_ostream << indentation() << _line << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,157 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of solidity.
|
|
||||||
|
|
||||||
solidity is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
solidity is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @author Christian <c@ethdev.com>
|
|
||||||
* @date 2014
|
|
||||||
* Pretty-printer for the abstract syntax tree (the "pretty" is arguable), used for debugging.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <libsolidity/ast/ASTVisitor.h>
|
|
||||||
#include <libsolidity/interface/GasEstimator.h>
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
namespace dev
|
|
||||||
{
|
|
||||||
namespace solidity
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pretty-printer for the abstract syntax tree (the "pretty" is arguable) for debugging purposes.
|
|
||||||
*/
|
|
||||||
class ASTPrinter: public ASTConstVisitor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// Create a printer for the given abstract syntax tree. If the source is specified,
|
|
||||||
/// the corresponding parts of the source are printed with each node.
|
|
||||||
ASTPrinter(
|
|
||||||
ASTNode const& _ast,
|
|
||||||
std::string const& _source = std::string(),
|
|
||||||
GasEstimator::ASTGasConsumption const& _gasCosts = GasEstimator::ASTGasConsumption()
|
|
||||||
);
|
|
||||||
/// Output the string representation of the AST to _stream.
|
|
||||||
void print(std::ostream& _stream);
|
|
||||||
|
|
||||||
bool visit(PragmaDirective const& _node) override;
|
|
||||||
bool visit(ImportDirective const& _node) override;
|
|
||||||
bool visit(ContractDefinition const& _node) override;
|
|
||||||
bool visit(InheritanceSpecifier const& _node) override;
|
|
||||||
bool visit(UsingForDirective const& _node) override;
|
|
||||||
bool visit(StructDefinition const& _node) override;
|
|
||||||
bool visit(EnumDefinition const& _node) override;
|
|
||||||
bool visit(EnumValue const& _node) override;
|
|
||||||
bool visit(ParameterList const& _node) override;
|
|
||||||
bool visit(OverrideSpecifier const& _node) override;
|
|
||||||
bool visit(FunctionDefinition const& _node) override;
|
|
||||||
bool visit(VariableDeclaration const& _node) override;
|
|
||||||
bool visit(ModifierDefinition const& _node) override;
|
|
||||||
bool visit(ModifierInvocation const& _node) override;
|
|
||||||
bool visit(EventDefinition const& _node) override;
|
|
||||||
bool visit(ElementaryTypeName const& _node) override;
|
|
||||||
bool visit(UserDefinedTypeName const& _node) override;
|
|
||||||
bool visit(FunctionTypeName const& _node) override;
|
|
||||||
bool visit(Mapping const& _node) override;
|
|
||||||
bool visit(ArrayTypeName const& _node) override;
|
|
||||||
bool visit(InlineAssembly const& _node) override;
|
|
||||||
bool visit(Block const& _node) override;
|
|
||||||
bool visit(PlaceholderStatement const& _node) override;
|
|
||||||
bool visit(IfStatement const& _node) override;
|
|
||||||
bool visit(WhileStatement const& _node) override;
|
|
||||||
bool visit(ForStatement const& _node) override;
|
|
||||||
bool visit(Continue const& _node) override;
|
|
||||||
bool visit(Break const& _node) override;
|
|
||||||
bool visit(Return const& _node) override;
|
|
||||||
bool visit(Throw const& _node) override;
|
|
||||||
bool visit(EmitStatement const& _node) override;
|
|
||||||
bool visit(VariableDeclarationStatement const& _node) override;
|
|
||||||
bool visit(ExpressionStatement const& _node) override;
|
|
||||||
bool visit(Conditional const& _node) override;
|
|
||||||
bool visit(Assignment const& _node) override;
|
|
||||||
bool visit(TupleExpression const& _node) override;
|
|
||||||
bool visit(UnaryOperation const& _node) override;
|
|
||||||
bool visit(BinaryOperation const& _node) override;
|
|
||||||
bool visit(FunctionCall const& _node) override;
|
|
||||||
bool visit(NewExpression const& _node) override;
|
|
||||||
bool visit(MemberAccess const& _node) override;
|
|
||||||
bool visit(IndexAccess const& _node) override;
|
|
||||||
bool visit(Identifier const& _node) override;
|
|
||||||
bool visit(ElementaryTypeNameExpression const& _node) override;
|
|
||||||
bool visit(Literal const& _node) override;
|
|
||||||
|
|
||||||
void endVisit(PragmaDirective const&) override;
|
|
||||||
void endVisit(ImportDirective const&) override;
|
|
||||||
void endVisit(ContractDefinition const&) override;
|
|
||||||
void endVisit(InheritanceSpecifier const&) override;
|
|
||||||
void endVisit(UsingForDirective const&) override;
|
|
||||||
void endVisit(StructDefinition const&) override;
|
|
||||||
void endVisit(EnumDefinition const&) override;
|
|
||||||
void endVisit(EnumValue const&) override;
|
|
||||||
void endVisit(ParameterList const&) override;
|
|
||||||
void endVisit(OverrideSpecifier const&) override;
|
|
||||||
void endVisit(FunctionDefinition const&) override;
|
|
||||||
void endVisit(VariableDeclaration const&) override;
|
|
||||||
void endVisit(ModifierDefinition const&) override;
|
|
||||||
void endVisit(ModifierInvocation const&) override;
|
|
||||||
void endVisit(EventDefinition const&) override;
|
|
||||||
void endVisit(ElementaryTypeName const&) override;
|
|
||||||
void endVisit(UserDefinedTypeName const&) override;
|
|
||||||
void endVisit(FunctionTypeName const&) override;
|
|
||||||
void endVisit(Mapping const&) override;
|
|
||||||
void endVisit(ArrayTypeName const&) override;
|
|
||||||
void endVisit(InlineAssembly const&) override;
|
|
||||||
void endVisit(Block const&) override;
|
|
||||||
void endVisit(PlaceholderStatement const&) override;
|
|
||||||
void endVisit(IfStatement const&) override;
|
|
||||||
void endVisit(WhileStatement const&) override;
|
|
||||||
void endVisit(ForStatement const&) override;
|
|
||||||
void endVisit(Continue const&) override;
|
|
||||||
void endVisit(Break const&) override;
|
|
||||||
void endVisit(Return const&) override;
|
|
||||||
void endVisit(Throw const&) override;
|
|
||||||
void endVisit(EmitStatement const&) override;
|
|
||||||
void endVisit(VariableDeclarationStatement const&) override;
|
|
||||||
void endVisit(ExpressionStatement const&) override;
|
|
||||||
void endVisit(Conditional const&) override;
|
|
||||||
void endVisit(Assignment const&) override;
|
|
||||||
void endVisit(TupleExpression const&) override;
|
|
||||||
void endVisit(UnaryOperation const&) override;
|
|
||||||
void endVisit(BinaryOperation const&) override;
|
|
||||||
void endVisit(FunctionCall const&) override;
|
|
||||||
void endVisit(NewExpression const&) override;
|
|
||||||
void endVisit(MemberAccess const&) override;
|
|
||||||
void endVisit(IndexAccess const&) override;
|
|
||||||
void endVisit(Identifier const&) override;
|
|
||||||
void endVisit(ElementaryTypeNameExpression const&) override;
|
|
||||||
void endVisit(Literal const&) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void printSourcePart(ASTNode const& _node);
|
|
||||||
void printType(Expression const& _expression);
|
|
||||||
std::string indentation() const;
|
|
||||||
void writeLine(std::string const& _line);
|
|
||||||
bool goDeeper() { m_indentation++; return true; }
|
|
||||||
|
|
||||||
int m_indentation;
|
|
||||||
std::string m_source;
|
|
||||||
ASTNode const* m_ast;
|
|
||||||
GasEstimator::ASTGasConsumption m_gasCosts;
|
|
||||||
std::ostream* m_ostream = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,7 +6,7 @@
|
|||||||
REPO_ROOT="$(dirname "$0")"/..
|
REPO_ROOT="$(dirname "$0")"/..
|
||||||
cd $REPO_ROOT
|
cd $REPO_ROOT
|
||||||
|
|
||||||
WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE")
|
WHITESPACE=$(git grep -n -I -E "^.*[[:space:]]+$" | grep -v "test/libsolidity/ASTJSON\|test/libsolidity/ASTRecoveryTests\|test/compilationTests/zeppelin/LICENSE\|test/cmdlineTests/recovery_ast_constructor/output")
|
||||||
|
|
||||||
if [[ "$WHITESPACE" != "" ]]
|
if [[ "$WHITESPACE" != "" ]]
|
||||||
then
|
then
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <libsolidity/interface/Version.h>
|
#include <libsolidity/interface/Version.h>
|
||||||
#include <libsolidity/parsing/Parser.h>
|
#include <libsolidity/parsing/Parser.h>
|
||||||
#include <libsolidity/ast/ASTPrinter.h>
|
|
||||||
#include <libsolidity/ast/ASTJsonConverter.h>
|
#include <libsolidity/ast/ASTJsonConverter.h>
|
||||||
#include <libsolidity/analysis/NameAndTypeResolver.h>
|
#include <libsolidity/analysis/NameAndTypeResolver.h>
|
||||||
#include <libsolidity/interface/CompilerStack.h>
|
#include <libsolidity/interface/CompilerStack.h>
|
||||||
@ -158,7 +157,6 @@ static string const g_argAllowPaths = g_strAllowPaths;
|
|||||||
static string const g_argAsm = g_strAsm;
|
static string const g_argAsm = g_strAsm;
|
||||||
static string const g_argAsmJson = g_strAsmJson;
|
static string const g_argAsmJson = g_strAsmJson;
|
||||||
static string const g_argAssemble = g_strAssemble;
|
static string const g_argAssemble = g_strAssemble;
|
||||||
static string const g_argAst = g_strAst;
|
|
||||||
static string const g_argAstCompactJson = g_strAstCompactJson;
|
static string const g_argAstCompactJson = g_strAstCompactJson;
|
||||||
static string const g_argAstJson = g_strAstJson;
|
static string const g_argAstJson = g_strAstJson;
|
||||||
static string const g_argBinary = g_strBinary;
|
static string const g_argBinary = g_strBinary;
|
||||||
@ -711,7 +709,6 @@ Allowed options)",
|
|||||||
(g_argIgnoreMissingFiles.c_str(), "Ignore missing files.");
|
(g_argIgnoreMissingFiles.c_str(), "Ignore missing files.");
|
||||||
po::options_description outputComponents("Output Components");
|
po::options_description outputComponents("Output Components");
|
||||||
outputComponents.add_options()
|
outputComponents.add_options()
|
||||||
(g_argAst.c_str(), "AST of all source files.")
|
|
||||||
(g_argAstJson.c_str(), "AST of all source files in JSON format.")
|
(g_argAstJson.c_str(), "AST of all source files in JSON format.")
|
||||||
(g_argAstCompactJson.c_str(), "AST of all source files in a compact JSON format.")
|
(g_argAstCompactJson.c_str(), "AST of all source files in a compact JSON format.")
|
||||||
(g_argAsm.c_str(), "EVM assembly of the contracts.")
|
(g_argAsm.c_str(), "EVM assembly of the contracts.")
|
||||||
@ -1108,9 +1105,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
|
|||||||
{
|
{
|
||||||
string title;
|
string title;
|
||||||
|
|
||||||
if (_argStr == g_argAst)
|
if (_argStr == g_argAstJson)
|
||||||
title = "Syntax trees:";
|
|
||||||
else if (_argStr == g_argAstJson)
|
|
||||||
title = "JSON AST:";
|
title = "JSON AST:";
|
||||||
else if (_argStr == g_argAstCompactJson)
|
else if (_argStr == g_argAstCompactJson)
|
||||||
title = "JSON AST (compact format):";
|
title = "JSON AST (compact format):";
|
||||||
@ -1143,16 +1138,8 @@ void CommandLineInterface::handleAst(string const& _argStr)
|
|||||||
{
|
{
|
||||||
stringstream data;
|
stringstream data;
|
||||||
string postfix = "";
|
string postfix = "";
|
||||||
if (_argStr == g_argAst)
|
ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(data, m_compiler->ast(sourceCode.first));
|
||||||
{
|
postfix += "_json";
|
||||||
ASTPrinter printer(m_compiler->ast(sourceCode.first), sourceCode.second);
|
|
||||||
printer.print(data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(data, m_compiler->ast(sourceCode.first));
|
|
||||||
postfix += "_json";
|
|
||||||
}
|
|
||||||
boost::filesystem::path path(sourceCode.first);
|
boost::filesystem::path path(sourceCode.first);
|
||||||
createFile(path.filename().string() + postfix + ".ast", data.str());
|
createFile(path.filename().string() + postfix + ".ast", data.str());
|
||||||
}
|
}
|
||||||
@ -1163,17 +1150,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
|
|||||||
for (auto const& sourceCode: m_sourceCodes)
|
for (auto const& sourceCode: m_sourceCodes)
|
||||||
{
|
{
|
||||||
sout() << endl << "======= " << sourceCode.first << " =======" << endl;
|
sout() << endl << "======= " << sourceCode.first << " =======" << endl;
|
||||||
if (_argStr == g_argAst)
|
ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(sout(), m_compiler->ast(sourceCode.first));
|
||||||
{
|
|
||||||
ASTPrinter printer(
|
|
||||||
m_compiler->ast(sourceCode.first),
|
|
||||||
sourceCode.second,
|
|
||||||
gasCosts
|
|
||||||
);
|
|
||||||
printer.print(sout());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ASTJsonConverter(legacyFormat, m_compiler->sourceIndices()).print(sout(), m_compiler->ast(sourceCode.first));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1398,7 +1375,6 @@ void CommandLineInterface::outputCompilationResults()
|
|||||||
handleCombinedJSON();
|
handleCombinedJSON();
|
||||||
|
|
||||||
// do we need AST output?
|
// do we need AST output?
|
||||||
handleAst(g_argAst);
|
|
||||||
handleAst(g_argAstJson);
|
handleAst(g_argAstJson);
|
||||||
handleAst(g_argAstCompactJson);
|
handleAst(g_argAstCompactJson);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
--error-recovery --ast --hashes
|
--error-recovery --ast-json --hashes
|
||||||
|
@ -1,34 +1,244 @@
|
|||||||
Syntax trees:
|
JSON AST:
|
||||||
|
|
||||||
|
|
||||||
======= recovery_ast_constructor/input.sol =======
|
======= recovery_ast_constructor/input.sol =======
|
||||||
PragmaDirective
|
{
|
||||||
Source: "pragma solidity >=0.0.0;"
|
"attributes" :
|
||||||
ContractDefinition "Error1"
|
{
|
||||||
Source: "contract Error1 {\n constructor() public {\n balances[tx.origin] = ; // missing RHS.\n }\n\n // Without error recovery we stop due to the above error.\n // Error recovery however recovers at the above ';'\n // There should be an AST for the above, albeit with error\n // nodes.\n\n // This function parses properly and should give AST info.\n function five() public view returns(uint) {\n return 5;\n }\n}"
|
"absolutePath" : "recovery_ast_constructor/input.sol",
|
||||||
FunctionDefinition "" - public
|
"exportedSymbols" :
|
||||||
Source: "constructor() public {\n balances[tx.origin] = ; // missing RHS.\n }"
|
{
|
||||||
ParameterList
|
"Error1" :
|
||||||
Source: "()"
|
[
|
||||||
ParameterList
|
18
|
||||||
Source: ""
|
]
|
||||||
Block
|
}
|
||||||
Source: "{\n balances[tx.origin] = ; // missing RHS.\n }"
|
},
|
||||||
FunctionDefinition "five" - public - const
|
"children" :
|
||||||
Source: "function five() public view returns(uint) {\n return 5;\n }"
|
[
|
||||||
ParameterList
|
{
|
||||||
Source: "()"
|
"attributes" :
|
||||||
ParameterList
|
{
|
||||||
Source: "(uint)"
|
"literals" :
|
||||||
VariableDeclaration ""
|
[
|
||||||
Type: uint256
|
"solidity",
|
||||||
Source: "uint"
|
">=",
|
||||||
ElementaryTypeName uint
|
"0.0",
|
||||||
Source: "uint"
|
".0"
|
||||||
Block
|
]
|
||||||
Source: "{\n return 5;\n }"
|
},
|
||||||
Return
|
"id" : 1,
|
||||||
Source: "return 5"
|
"name" : "PragmaDirective",
|
||||||
Literal, token: [no token] value: 5
|
"src" : "0:24:0"
|
||||||
Type: int_const 5
|
},
|
||||||
Source: "5"
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"baseContracts" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"contractDependencies" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"contractKind" : "contract",
|
||||||
|
"documentation" : null,
|
||||||
|
"fullyImplemented" : true,
|
||||||
|
"linearizedBaseContracts" :
|
||||||
|
[
|
||||||
|
18
|
||||||
|
],
|
||||||
|
"name" : "Error1",
|
||||||
|
"scope" : 19
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : true,
|
||||||
|
"kind" : "constructor",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
|
"scope" : 18,
|
||||||
|
"stateMutability" : "nonpayable",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 2,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "57:2:0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 3,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "67:0:0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"statements" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 8,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "67:49:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 9,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "46:70:0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"documentation" : null,
|
||||||
|
"implemented" : true,
|
||||||
|
"isConstructor" : false,
|
||||||
|
"kind" : "function",
|
||||||
|
"modifiers" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
],
|
||||||
|
"name" : "five",
|
||||||
|
"overrides" : null,
|
||||||
|
"scope" : 18,
|
||||||
|
"stateMutability" : "view",
|
||||||
|
"superFunction" : null,
|
||||||
|
"visibility" : "public"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"parameters" :
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"children" : [],
|
||||||
|
"id" : 10,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "382:2:0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"constant" : false,
|
||||||
|
"name" : "",
|
||||||
|
"overrides" : null,
|
||||||
|
"scope" : 17,
|
||||||
|
"stateVariable" : false,
|
||||||
|
"storageLocation" : "default",
|
||||||
|
"type" : "uint256",
|
||||||
|
"value" : null,
|
||||||
|
"visibility" : "internal"
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"name" : "uint",
|
||||||
|
"type" : "uint256"
|
||||||
|
},
|
||||||
|
"id" : 11,
|
||||||
|
"name" : "ElementaryTypeName",
|
||||||
|
"src" : "405:4:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 12,
|
||||||
|
"name" : "VariableDeclaration",
|
||||||
|
"src" : "405:4:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 13,
|
||||||
|
"name" : "ParameterList",
|
||||||
|
"src" : "404:6:0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"functionReturnParameters" : 13
|
||||||
|
},
|
||||||
|
"children" :
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"attributes" :
|
||||||
|
{
|
||||||
|
"argumentTypes" : null,
|
||||||
|
"hexvalue" : "35",
|
||||||
|
"isConstant" : false,
|
||||||
|
"isLValue" : false,
|
||||||
|
"isPure" : true,
|
||||||
|
"lValueRequested" : false,
|
||||||
|
"subdenomination" : null,
|
||||||
|
"token" : "number",
|
||||||
|
"type" : "int_const 5",
|
||||||
|
"value" : "5"
|
||||||
|
},
|
||||||
|
"id" : 14,
|
||||||
|
"name" : "Literal",
|
||||||
|
"src" : "424:1:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 15,
|
||||||
|
"name" : "Return",
|
||||||
|
"src" : "417:8:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 16,
|
||||||
|
"name" : "Block",
|
||||||
|
"src" : "411:19:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 17,
|
||||||
|
"name" : "FunctionDefinition",
|
||||||
|
"src" : "369:61:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 18,
|
||||||
|
"name" : "ContractDefinition",
|
||||||
|
"src" : "26:406:0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id" : 19,
|
||||||
|
"name" : "SourceUnit",
|
||||||
|
"src" : "0:433:0"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user