Console ShowASTs not working?

Hi

I tried to view what AST’s was being generated when I executed a very
simple
class with the following command line

rbx -X:ShowASTs test.rb

class HelloWorld
def initialize
@msg = “hello world”

end

def print
puts @msg
end
end

h = HelloWorld.new
h.print

I tried doing that on windows in powershell, cmd and on OSX with mono

I also tried a couple of other command switches but none of them seem to
do
anything, is that because it’s not supposed to be working?
the other command options i tried were -X:TabCompletion, -X:DumpASTs and
-X:ShowRules
None of them seem to have any effect, do I submit a bug for this?

Thanks
Ivan

-X:ShowASTs works for me. Linux, Mono 1.2.6, IronRuby r76.

Cool it’s working for me too, it was just me being stupid.

2008/3/12, Brian J. Cardiff [email protected]:

Not so important, but why the AST is shown twice?

One is before rewriting, the other is after rewriting.

See Microsoft.Scripting/Ast/Compiler.cs, from line 485:

private static void AnalyzeBlock(CodeBlock block) {
DumpBlock(block);

ForestRewriter.Rewrite(block);
ClosureBinder.Bind(block);
FlowChecker.Check(block);

DumpBlock(block);

}

Not so important, but why the AST is shown twice?

rbx /X:ShowASTs
IronRuby 0.1 on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.

Note that local variables do not work today in the console.
As a workaround, use globals instead (eg $x = 42 instead of x = 42).

1
//
// AST wrapper
//

.codeblock Object wrapper ( global,)() {

.return (RubyOps.RunMain)(
    .context,
    (Boolean)True,
    (Object).block (main #1),
);

}
//
// CODE BLOCK: main (1)
//

.codeblock Object main ()() {
.var RuntimeFlowControl #rfc (Local)
.var Object #self (Local)
.var RubyScope #scope (Local)

{
    (.bound #scope) = (RubyOps.GetScope)(
        .context,
    )
    (.bound #rfc) = (RubyOps.GetRfc)(
        (.bound #scope),
    )
    (.bound #self) = (RubyOps.GetSelf)(
        (.bound #scope),
    )
    {
        .return 1;
    }
}

}
//
// AST wrapper
//

.codeblock Object wrapper ( global,)() {

.return (RubyOps.RunMain)(
    .context,
    (Boolean)True,
    (Object).block (main #1),
);

}
//
// CODE BLOCK: main (1)
//

.codeblock Object main ()() {
.var RuntimeFlowControl #rfc (Local)
.var Object #self (Local)
.var RubyScope #scope (Local)

{
    (.bound #scope) = (RubyOps.GetScope)(
        .context,
    )
    (.bound #rfc) = (RubyOps.GetRfc)(
        (.bound #scope),
    )
    (.bound #self) = (RubyOps.GetSelf)(
        (.bound #scope),
    )
    {
        .return 1;
    }
}

}
=> 1

On Wed, Mar 12, 2008 at 8:47 AM, Ivan Porto C.
[email protected]