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

Bug 361262

Summary: Literal in constructors are not generated correctly
Product: z_Archived Reporter: Joseph Vincens <jvincens>
Component: EDTAssignee: Jeff Douglas <jeffdouglas>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas, jqian, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
testcase none

Description Joseph Vincens CLA 2011-10-18 10:32:29 EDT
I will attach a handler to illustrate.
in the following function:
    function setValue(p1 decimal in)
    	ui.children.removeAll();
		ui.appendChild(new GridLayout{columns = 1, rows = 6, cellPadding = 0, children =[ Button,
    		new HTML{text = "p1", layoutData = new GridLayoutData{ row = 2, column = 1 } },
//    		new HTML{text = strlib.formatDate(p1,"MM/dd/yyyy"), layoutData = new GridLayoutData{ row = 2, column = 2 } }
    		new HTML{text = strlib.formatNumber(p1,"##.##"), layoutData = new GridLayoutData{ row = 2, column = 2 } }
    	]});
    end
The "##.##" literal is generated after the call to formatNumber.
Comment 1 Joseph Vincens CLA 2011-10-18 10:33:10 EDT
Created attachment 205425 [details]
testcase
Comment 2 Scott Greer CLA 2011-10-31 10:08:04 EDT
Perhaps this is an issue with ReorganizeCode -- it seems odd that the literall would be factored out like this....
Comment 3 Jing Qian CLA 2011-11-21 14:26:52 EST
Joe, I think the number format issue is resolved on 201111210901's build, however, I think there is something not right about the HTML text aren't showing in the row2, column2.

If I use sysLib.writeStdout(), it is writing out 12.65 for javascript
Comment 4 Jing Qian CLA 2011-11-21 14:40:49 EST
actually, I reopen this one

the code should be modified to row =3, column = 1

new HTML{text = strlib.formatNumber(p1,"##.##"), layoutData = new
GridLayoutData{ row = 3, column = 1 }

It is printing null, but if it's used by itself in sysLib.writeStdout(strlib.formatNumber(p1, "##.##"), it is printing 12.65

also, if I put the new HTML as a member field of the RUIHandler, it is showing it correctly. 

I think there is some issue with ui.children.removeAll or ui.appendChild....
Comment 5 Jing Qian CLA 2011-11-21 14:41:10 EST
defer this
Comment 6 Jing Qian CLA 2011-11-21 14:49:04 EST
Brian looked into this, seems is still the problem with reorg code.

the generated temp variable for "##.##" is declared below when it is used.
Comment 7 Jeff Douglas CLA 2011-11-21 15:16:26 EST
This is something that I should look into, as Reorg Code is complicated
Comment 8 Jing Qian CLA 2011-11-21 20:02:14 EST
NOT for 070, please wait till after 070
Comment 9 Jeff Douglas CLA 2011-12-23 11:44:11 EST
fixed
Comment 10 Joseph Vincens CLA 2012-03-13 07:11:55 EDT
verified