poorna2152 / nballerina

WebAssembly Backend for the nBallerina compiler
https://ballerina.io/
Apache License 2.0
4 stars 0 forks source link

Refactor region generation #38

Closed poorna2152 closed 2 years ago

poorna2152 commented 2 years ago

To fix:

Either have to create Regions when generating doing codegen or have to create regions after all blocks are created by traversing the graph

poorna2152 commented 2 years ago

Following needs to be fixed,

  1. while08-v.bal
    
    import ballerina/io;

public function main() { foo(); }

function foo() { boolean b = false; while b { io:println(0); } }

<img width="294" alt="while08" src="https://user-images.githubusercontent.com/58025190/169445583-5a8c3ca0-198e-4600-9ba2-35b8e4606ba4.PNG">

2. [while10-v.bal](https://github.com/poorna2152/nballerina/blob/main/compiler/testSuite/01-loop/while10-v.bal)

import ballerina/io;

public function main() { int i = 0; while true { if !(i < 3) { break; } io:println(i); i = i + 1; } }


<img width="259" alt="while10" src="https://user-images.githubusercontent.com/58025190/169445694-c38e6be1-dcfd-41a3-ac3f-9e5d65fa287b.PNG">