Bug 384837 - Unbox the temp variable for an OUT parameter before
assigning it to the argument.
diff --git a/gen/org.eclipse.edt.gen.javascript.templates/src/org/eclipse/edt/gen/javascript/templates/TypeTemplate.java b/gen/org.eclipse.edt.gen.javascript.templates/src/org/eclipse/edt/gen/javascript/templates/TypeTemplate.java
index e0794e0..f2ef5de 100644
--- a/gen/org.eclipse.edt.gen.javascript.templates/src/org/eclipse/edt/gen/javascript/templates/TypeTemplate.java
+++ b/gen/org.eclipse.edt.gen.javascript.templates/src/org/eclipse/edt/gen/javascript/templates/TypeTemplate.java
@@ -299,10 +299,19 @@
 			if (objectExpr instanceof BoxingExpression){
 				objectExpr = ((BoxingExpression)objectExpr).getExpr();
 			}
+			
+			Member member = CommonUtilities.getMember(objectExpr);
+			ParameterKind paramKind = member == null ? null : (ParameterKind)ctx.getAttribute(member, org.eclipse.edt.gen.Constants.SubKey_functionArgumentTemporaryVariable);
+			if (paramKind == ParameterKind.PARM_OUT) {
+				out.print("egl.unboxAny(");
+			}
 			ctx.invoke(genExpression, objectExpr, ctx, out);
 			if(objectExpr.getType() instanceof Record && ctx.getAttribute(arg, "function parameter is const in") == null){
 				out.print(".eze$$clone()");
 			}
+			if (paramKind == ParameterKind.PARM_OUT) {
+				out.print(')');
+			}
 			ctx.invoke(genTypeDependentPatterns, arg.getObjectExpr().getType(), ctx, out);
 			
 			String typeSignature = arg.getObjectExpr().getType().getClassifier().getTypeSignature();			
diff --git a/runtimes/org.eclipse.edt.runtime.javascript/runtime/edt_runtime.js b/runtimes/org.eclipse.edt.runtime.javascript/runtime/edt_runtime.js
index 2b65117..faf16dc 100644
--- a/runtimes/org.eclipse.edt.runtime.javascript/runtime/edt_runtime.js
+++ b/runtimes/org.eclipse.edt.runtime.javascript/runtime/edt_runtime.js
@@ -243,7 +243,7 @@
 	return egl.convertAnyToInt(x,false, egl.createNumericOverflowException);  //TODO sbg avoid hardcoding the boolean flag
 };
 egl.eglx.lang.EInt32.fromEInt64 = function (x) {
-	return egl.convertDecimalToInt(egl.unboxAny(x), egl.createNumericOverflowException);
+	return egl.convertDecimalToInt(x, egl.createNumericOverflowException);
 };
 egl.eglx.lang.EInt32.fromEFloat32 = function (x) {
 	return egl.convertFloatToInt(x, egl.createNumericOverflowException);