Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Import AST from JSON format (try 2) #2500

Closed
wants to merge 10 commits into from

Conversation

djudjuu
Copy link
Contributor

@djudjuu djudjuu commented Jul 1, 2017

I rebased the branch, included the CR's from the original branch and cleaned up the code.

Replaces #2328.

Closes #2096.

@djudjuu
Copy link
Contributor Author

djudjuu commented Jul 1, 2017

There is one bit about which i am unhappy and would like your help:
When the code compilation leads to warnings, the method SourceReferenceFormatter::printExceptionInformation() wants to output the sourceLocation, which will always print the entire Json-file. This is not really helpful.
Also, as InlineAssemblyeCode needs its own scanner, I needed to add an extra variable m_currentSourceName to ASTJsonImporter which is only used once.

I think the most appropriate way would be deal with the the generated warninsgs would be to output only the type of warning without the entire code. I am unsure about how to (elegantly) adjust the printExceptionInformation to that end.
i guess it's easiest to discuss this on a call...

@axic
Copy link
Member

axic commented Jul 1, 2017

Is this replacing #2328?

@djudjuu
Copy link
Contributor Author

djudjuu commented Jul 1, 2017 via email

Changelog.md Outdated Show resolved Hide resolved
@axic
Copy link
Member

axic commented Jul 12, 2017

@djudjuu pushed this changeset to the original branch to see which comments were left open (there are a couple), can you please check them there?

@axic axic changed the title Import ast [WIP] Import AST from JSON format (try 2) Aug 16, 2017
@djudjuu
Copy link
Contributor Author

djudjuu commented Sep 24, 2017

Hi @axic ,
I took another go at it, included all changes that were still missing, rebased it onto the current develop (in the process I had to squash my many commits into fewer and do a force push, although it meant that some of your comments are gone now, but otherwise i'd gone nuts. (They were some whitespace errors and some refactoring, no real design choices or the like....).
I also included the comments from #2328.

Also, I put a question in the comment in CompilerStack.cpp l. 846....it's in the metadata creation function, which is also the place where I felt the most unsure about my choices.

solc/CommandLineInterface.cpp Outdated Show resolved Hide resolved
test/libsolidity/ASTJSON.cpp Outdated Show resolved Hide resolved
@axic
Copy link
Member

axic commented Oct 10, 2017

Sorry for the delay. Thanks! Pushed your version to #2328 and can confirm all the questions were addressed.

@chriseth
Copy link
Contributor

cheer

@djudjuu
Copy link
Contributor Author

djudjuu commented Mar 18, 2018

I (finally) updated the missing pieces, yet I don't know what to do about the appveyor error. @chriseth can you help?

Copy link
Member

@axic axic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase also.

@@ -73,6 +73,9 @@ class CommandLineInterface

/// Fills @a m_sourceCodes initially and @a m_redirects.
void readInputFilesAndConfigureRemappings();
/// Tries to read the ASTs from @ m_sourceCodes and to generate the input for
/// the compiler's importASTs()-function.
std::map<std::string, Json::Value const*> parseAstFromInput(); //use const here?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use const if it isn't changing the state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it does set m_sourceCodes

also it reads the input file into a newly created Json::Value which after that never changes, thats why i though that Json::Value have a const*.

not sure, what that implies...

@@ -204,6 +204,7 @@ Bugfixes:
Features:
* Syntax Checker: Deprecated "throw" in favour of require(), assert() and revert().
* Type Checker: Warn if a local storage reference variable does not explicitly use the keyword ``storage``.
* AST: import a Json to AST.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong version, also please capitalise to JSON.

libsolidity/ast/ASTJsonImporter.h Show resolved Hide resolved
private:
template <typename T, typename... Args>
ASTPointer<T> createASTNode(Json::Value const& _node, Args&&... _args);
SourceLocation const createSourceLocation(Json::Value const& _node);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this really be const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i though so, as the json that is passed in is never modified.

libsolidity/ast/ASTJsonImporter.h Show resolved Hide resolved
libsolidity/ast/ASTJsonImporter.h Show resolved Hide resolved
@axic axic added this to Inbox in Backlog (non-breaking) via automation Sep 26, 2018
@ekpyron
Copy link
Member

ekpyron commented Nov 5, 2018

@djudjuu Are you planning on continuing with this? I'm just starting to look into it and I could help you in rebasing it (it has been dormant for quite a while now) and finishing it - or I could just take it over.

@djudjuu
Copy link
Contributor Author

djudjuu commented Nov 5, 2018 via email

@ekpyron
Copy link
Member

ekpyron commented Nov 5, 2018

@djudjuu Ok, sounds great! I'll probably look into rebasing it sometime this week then and after that we can decide how to proceed.

@axic
Copy link
Member

axic commented Nov 21, 2018

Submodule deps added at b3db89

Should be removed.

@ekpyron
Copy link
Member

ekpyron commented Nov 22, 2018

I looked into rebasing this a while ago, but the PR seems to be in a somewhat messy state (e.g. there's merge conflict markers in some of the commits that are only removed later, etc.) - so it may make sense to recreate it from scratch instead.

@axic
Copy link
Member

axic commented Nov 22, 2018

I tried rebasing it yesterday, but due to the merge commits it is rather hard. Tried rebasing it on an older head just to remove the merge and then squash, but haven't finished it yet.

@chriseth
Copy link
Contributor

chriseth commented Dec 5, 2018

It is probably easier to just create this from scratch.

@chriseth chriseth closed this Dec 5, 2018
Backlog (non-breaking) automation moved this from Inbox to Done Dec 5, 2018
@axic axic mentioned this pull request Jan 12, 2019
@djudjuu
Copy link
Contributor Author

djudjuu commented Jul 18, 2019

Hi @ekpyron,

I restarted work on this again over here: djudjuu#1

let me know if you want to help out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

AST: import from json
4 participants