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

Bug 361493

Summary: The initialization code for widget created by "new" is duplicate
Product: z_Archived Reporter: Huang Ji Yong <hjiyong>
Component: EDTAssignee: Yun Feng Ma <mayunf>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: greer, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
test case none

Description Huang Ji Yong CLA 2011-10-20 01:17:02 EDT
Open the attached egl file. The code for a new DojoContentPane is generated twice.
var eze$Temp2 = null;
{
	var eze$SettingTarget1 = new egl.dojo.widgets.DojoContentPane();
	egl.atLine(this.eze$$fileName,20,600,53, this);
	eze$SettingTarget1 = new egl.dojo.widgets.DojoContentPane();
	egl.setWidgetLocation(eze$SettingTarget1, 'eze$SettingTarget1', 600, 53, true);
}
Comment 1 Huang Ji Yong CLA 2011-10-20 01:27:32 EDT
Created attachment 205576 [details]
test case
Comment 2 Scott Greer CLA 2011-10-31 10:06:59 EDT
This isn't specific to widgets.  Somewhat recently, Java gen fixed this by adding logic to decide when it could emit a single line to cover the declaration and initialization for a given field.   This is contained in DeclarationExpressionTemplate and FieldTemplate (and possibly other places), so this logic needs to be "ported" over to the JS gen templates.   Check with Jeff if there are questions about this.
Comment 3 Yun Feng Ma CLA 2011-11-17 11:01:59 EST
Fixed, borrowed JavaGen logic. Thanks.
Comment 4 Huang Ji Yong CLA 2011-11-23 03:00:21 EST
Verified in build 201111210901