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

Bug 360722

Summary: can not assign array for array inout and out parameter
Product: z_Archived Reporter: Jing Qian <jqian>
Component: EDTAssignee: Scott Greer <greer>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P1    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jing Qian CLA 2011-10-12 15:54:03 EDT
This is a critical bug, because this blocks many variations (> 15 variations)

Try the following code, you will get exception saying 

Invalid assignment left-hand side for the following line
recArray = new SimpleRecord[0];

both out and inout for this array parameter would give me this error.

same function runs correctly in java

package handlers;

// RUI Handler



//
//

handler h2 type RUIhandler{initialUI =[
            ], onConstructionFunction = start, cssFile = "css/b.css", title = "h2"}

   
	function start()

		simpleRecArray SimpleRecord[];
		initSimpleRecordArray(simpleRecArray);      
		i int = simpleRecArray.getSize();
		sysLib.writeStdout("size: " + i);
		sysLib.writeStdOut(simpleRecArray[i].item1);		
		  
	end
	
	function initSimpleRecordArray(recArray SimpleRecord[] out)
		temp SimpleRecord;
		recArray = new SimpleRecord[0];   ==>Invalid assignment left-hand side
		
		temp.item1 = "Index 1";
		temp.item2 = 10;
		temp.item3 = 99999999.10;
		recArray.appendElement(temp);
		
		temp.item1 = "Index 1";
		temp.item2 = 20;
		temp.item3 = 99999999.20;
		recArray.appendElement(temp);
		
		temp.item1 = "Index 1";
		temp.item2 = 30;
		temp.item3 = 99999999.30;
		recArray.appendElement(temp);
		SysLib.writeStdOut("array size:" + recArray.getSize());
	end	
end


Record SimpleRecord
  item1 string;
  item2 int;
  item3 decimal(10,2);
end
Comment 1 Scott Greer CLA 2011-10-13 21:13:44 EDT
Fixed;  re-factored the logic for initializing arrays to mirror what Java gen does and this allows JS gen to correctly handle the boxed array parm in the testcase.
Comment 2 Jing Qian CLA 2011-11-11 15:25:02 EST
verified with 2011/11/11/0901's build