natalie-lang / natalie

a work-in-progress Ruby compiler, written in Ruby and C++

Home Page:https://natalie-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use the `--ast` properly?

stefanos82 opened this issue · comments

Based on --help, I can see there's a standalone --ast flag. I have attempted to use it and it throws an error message:

$ bin/natalie --ast examples/hello.rb 
/home/stefanos/development/repositories/natalie/build/prism/lib/prism/node.rb:2072:in `inspect': wrong number of arguments (given 1, expected 0) (ArgumentError)
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node.rb:2072:in `inspect'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node_inspector.rb:38:in `block in list'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node_inspector.rb:35:in `each'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node_inspector.rb:35:in `each_with_index'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node_inspector.rb:35:in `list'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node.rb:13131:in `inspect'
	from /home/stefanos/development/repositories/natalie/build/prism/lib/prism/node.rb:34:in `pretty_print'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:197:in `block in pp'
	from /usr/lib/ruby/3.1.0/prettyprint.rb:253:in `block (2 levels) in group'
	from /usr/lib/ruby/3.1.0/prettyprint.rb:280:in `nest'
	from /usr/lib/ruby/3.1.0/prettyprint.rb:252:in `block in group'
	from /usr/lib/ruby/3.1.0/prettyprint.rb:265:in `group_sub'
	from /usr/lib/ruby/3.1.0/prettyprint.rb:251:in `group'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:197:in `pp'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:93:in `block in pp'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:154:in `guard_inspect_key'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:93:in `pp'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:646:in `block in pp'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:645:in `each'
	from /home/stefanos/gems/gems/pp-0.4.0/lib/pp.rb:645:in `pp'
	from bin/natalie:153:in `run'
	from bin/natalie:323:in `<main>'

Can you please tell me what I'm doing wrong exactly here?

This is borked currently as we transition to using Prism nodes in pass1. I'll leave this open as a bug issue until it's fixed.

Ah phew... 😆 I thought I broke something by mistake and didn't know what it was or where to look!

This should be fixed now!