On Fri Feb 05 15:45:19 2016, alex.jakime...@gmail.com wrote:
> But let's start with something less impressive.
> 
> Code:
> say [;0]
> 
> Result:
> Non ast passed to WANTED: BOOTInt
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Weird node in analyze: BOOTInt
> ===SORRY!===
> Unknown QAST node type BOOTInt
> 
> 
> Woah! Ok, let's try this.
> 
> Code:
> [;]
> 
> Result:
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Weird node in analyze: BOOTInt
> ===SORRY!===
> Unknown QAST node type BOOTInt
> 
> Okay, that's a bit less impressive. Let's try with ()
> 
> Code:
> (;)
> 
> Result:
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> Non-QAST node visited BOOTInt
> Weird node visited: BOOTInt
> Resultchild 0 can't returns! BOOTInt
> - QAST::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
>   - QAST::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
>     - 0
> 
> … and so on.
> 
> Of course, the output is more impressive if you have some other code in the
> same file.

Fixed it so:

* We won't infinite loop in that place if we hit it again
* We don't do the debug spam in the optimizer, unless the debug environment 
variable is turned on
* We don't go sticking a raw integer into the AST on such constructs, which is 
what caused all the trouble in the first place

Tests in integration/weird-errors.t.

Reply via email to