Fix AST manipulation, for remove sourcify #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
maintenance of sourcify gem is not active.
because sourcify depends on old ruby_parser gem, some gem cause dependency collision.
I want to remove sourcify.
I write proc_to_ast.
this work like sourcify but more simple and lightweight.
this depends on whitequark/parser and mbj/unparser.
these gem is updated actively.
And I rewrite AST manipulation code, in order to adapt to above gems.
Current test code is all passed.
But I think that Proc to_source conversion and AST manipulation are still dangerous.
So, if you don't want to merge, close this PR.
英語が不安なので、一応日本語でも書いておきます。
sourcifyが古くなっていて、古いruby_parserに依存しているので何とかしたかったんですが、sourcifyをフォークするのも辛いので、自前でsourcifyの機能に近いものを書きました。
それに合わせてASTを弄る処理を一通り書き直して、とりあえず動作するようにはしました。
しかし、Procのコードのパースはかなり手抜きの実装になっていて、ASTの抽出があらゆるパターンでちゃんと動作するかは微妙です。パフォーマンスも余り考慮していません。
なので、PRは出させてもらいましたが、無理にマージしてもらう必要はありません。