Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362641

Summary: Debug js generator produce runtime error when there is label in EGL file
Product: z_Archived Reporter: Huang Ji Yong <hjiyong>
Component: EDTAssignee: Justin Spadea <jspadea>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: broy2, carrollk, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Fix label generation lasher: iplog+

Description Huang Ji Yong CLA 2011-11-02 04:57:31 EDT
The test case
f int = 5;
    function start()
    	myInt int = 5;    
        outerLoop: 
        while(f != 0)
            if(myInt == 1)
                exit outerLoop;
            end
            for(myInt from 1 to 100 by 1)
                if(f == 5)
                    exit for;
                end
            end
        end
        ;
        syslib.writeStdout("go here");
    end

The problem is in the generation of label and while statement
outerLoop: while(f != 0)

The development js generator generates the following js
egl.atLine(this.eze$$fileName,13,236,10, this);
EzeLabel_outerLoop: egl.atLine(this.eze$$fileName,13,247,235, this);	
while (((this.f != 0))) {

The correct js should be
egl.atLine(this.eze$$fileName,13,236,10, this);
EzeLabel_outerLoop: while (((this.f != 0))) {
Comment 1 Huang Ji Yong CLA 2011-11-03 05:04:13 EDT
Hi Justin,
This bug blocks the EUnit test case
api/systemTypes/languageStatements.egl function whileTest()
So I change the severity to major.

Brenda or Kathy,
Can you skip update the EUnit to skip this test case before this bug is resolved.
Thanks.
Comment 2 Justin Spadea CLA 2011-11-03 16:36:51 EDT
I spoke with Brian, and neither EXIT nor LABEL are supported in JSGen in RBD, so we decided to make this a 1.0 feature. I've updated the wiki to indicate it's not supported in 0.7.

To support this in debug mode we need to be able to generate a label in the middle of generating the statement that follows the label.

Please mark the testcase(s) as failed for now.
Comment 3 Justin Spadea CLA 2012-04-17 16:36:01 EDT
Created attachment 214145 [details]
Fix label generation
Comment 4 Justin Spadea CLA 2012-04-17 16:38:43 EDT
See patch for fix. Labels are now stored for later generation, so that they are between the atline() and the conditional.

atline(); // for the label below
atline(); // for the FOR loop below
LABEL1:
for (...) {
}
Comment 5 Huang Ji Yong CLA 2012-06-29 02:17:46 EDT
[Verified in build]: 
0.8.1.v201206271108