aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/ast/ASTJsonConverter.cpp45
-rw-r--r--libsolidity/ast/ASTJsonConverter.h8
-rw-r--r--scripts/Dockerfile2
-rwxr-xr-xscripts/docker_deploy.sh6
-rwxr-xr-xscripts/install_deps.sh4
5 files changed, 56 insertions, 9 deletions
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp
index 69c10c8d..9ea23687 100644
--- a/libsolidity/ast/ASTJsonConverter.cpp
+++ b/libsolidity/ast/ASTJsonConverter.cpp
@@ -40,6 +40,21 @@ void ASTJsonConverter::addJsonNode(
bool _hasChildren = false
)
{
+ ASTJsonConverter::addJsonNode(
+ _node,
+ _nodeName,
+ std::vector<pair<string const, Json::Value const>>(_attributes),
+ _hasChildren
+ );
+}
+
+void ASTJsonConverter::addJsonNode(
+ ASTNode const& _node,
+ string const& _nodeName,
+ std::vector<pair<string const, Json::Value const>> const& _attributes,
+ bool _hasChildren = false
+)
+{
Json::Value node;
node["id"] = Json::UInt64(_node.id());
@@ -183,11 +198,18 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
bool ASTJsonConverter::visit(VariableDeclaration const& _node)
{
- addJsonNode(_node, "VariableDeclaration", {
+ std::vector<pair<string const, Json::Value const>> attributes = {
make_pair("name", _node.name()),
- make_pair("type", type(_node))
- }, true);
+ make_pair("type", type(_node)),
+ make_pair("constant", _node.isConstant()),
+ make_pair("storageLocation", location(_node.referenceLocation())),
+ make_pair("visibility", visibility(_node.visibility()))
+ };
+ if (m_inEvent)
+ attributes.push_back(make_pair("indexed", _node.isIndexed()));
+ addJsonNode(_node, "VariableDeclaration", attributes, true);
return true;
+
}
bool ASTJsonConverter::visit(ModifierDefinition const& _node)
@@ -209,6 +231,7 @@ bool ASTJsonConverter::visit(TypeName const&)
bool ASTJsonConverter::visit(EventDefinition const& _node)
{
+ m_inEvent = true;
addJsonNode(_node, "EventDefinition", { make_pair("name", _node.name()) }, true);
return true;
}
@@ -502,6 +525,7 @@ void ASTJsonConverter::endVisit(ModifierInvocation const&)
void ASTJsonConverter::endVisit(EventDefinition const&)
{
+ m_inEvent = false;
goUp();
}
@@ -670,6 +694,21 @@ string ASTJsonConverter::visibility(Declaration::Visibility const& _visibility)
}
}
+string ASTJsonConverter::location(VariableDeclaration::Location _location)
+{
+ switch (_location)
+ {
+ case VariableDeclaration::Location::Default:
+ return "default";
+ case VariableDeclaration::Location::Storage:
+ return "storage";
+ case VariableDeclaration::Location::Memory:
+ return "memory";
+ default:
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown declaration location."));
+ }
+}
+
string ASTJsonConverter::type(Expression const& _expression)
{
return _expression.annotation().type ? _expression.annotation().type->toString() : "Unknown";
diff --git a/libsolidity/ast/ASTJsonConverter.h b/libsolidity/ast/ASTJsonConverter.h
index 49f23f99..bd5e6560 100644
--- a/libsolidity/ast/ASTJsonConverter.h
+++ b/libsolidity/ast/ASTJsonConverter.h
@@ -151,8 +151,15 @@ private:
std::initializer_list<std::pair<std::string const, Json::Value const>> _attributes,
bool _hasChildren
);
+ void addJsonNode(
+ ASTNode const& _node,
+ std::string const& _nodeName,
+ std::vector<std::pair<std::string const, Json::Value const>> const& _attributes,
+ bool _hasChildren
+ );
std::string sourceLocationToString(SourceLocation const& _location) const;
std::string visibility(Declaration::Visibility const& _visibility);
+ std::string location(VariableDeclaration::Location _location);
std::string type(Expression const& _expression);
std::string type(VariableDeclaration const& _varDecl);
inline void goUp()
@@ -161,6 +168,7 @@ private:
m_jsonNodePtrs.pop();
}
+ bool m_inEvent = false; ///< whether we are currently inside an event or not
bool processed = false;
Json::Value m_astJson;
std::stack<Json::Value*> m_jsonNodePtrs;
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index ad448fd3..c984ce99 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -14,3 +14,5 @@ make solc && install -s solc/solc /usr/bin &&\
cd / && rm -rf solidity &&\
apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev &&\
rm -rf /var/cache/apk/*
+
+ENTRYPOINT ["/usr/bin/solc"] \ No newline at end of file
diff --git a/scripts/docker_deploy.sh b/scripts/docker_deploy.sh
index d2810a3e..0abde840 100755
--- a/scripts/docker_deploy.sh
+++ b/scripts/docker_deploy.sh
@@ -10,13 +10,11 @@ then
docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT"
docker push ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT";
docker push ethereum/solc:nightly;
-elif [ "$TRAVIS_BRANCH" = "release" ]
-then
- docker tag ethereum/solc:build ethereum/solc:stable;
- docker push ethereum/solc:stable;
elif [ "$TRAVIS_TAG" = v"$version" ]
then
+ docker tag ethereum/solc:build ethereum/solc:stable;
docker tag ethereum/solc:build ethereum/solc:"$version";
+ docker push ethereum/solc:stable;
docker push ethereum/solc:"$version";
else
echo "Not publishing docker image from branch $TRAVIS_BRANCH or tag $TRAVIS_TAG"
diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh
index 7cfc92f2..81cde14c 100755
--- a/scripts/install_deps.sh
+++ b/scripts/install_deps.sh
@@ -96,7 +96,7 @@ case $(uname -s) in
brew update
brew install boost
brew install cmake
- if ["$CI" = true]; then
+ if [ "$CI" = true ]; then
brew upgrade cmake
brew tap ethereum/ethereum
brew install cpp-ethereum
@@ -394,4 +394,4 @@ case $(uname -s) in
echo "If you would like to get your operating system working, that would be fantastic."
echo "Drop us a message at https://gitter.im/ethereum/solidity."
;;
-esac \ No newline at end of file
+esac