public void VisitNode(JSNewBoxedVariable nbv) { GenericParameter relevantParameter; var initialValue = nbv.InitialValue; var initialValueDerefed = initialValue; initialValueDerefed = JSReferenceExpression.Strip(initialValueDerefed); var initialValueType = initialValueDerefed.GetActualType(TypeSystem); if (!nbv.SuppressClone && IsCopyNeeded(nbv.InitialValue, out relevantParameter) && // We don't need to make a copy if the source value is a reference (like T& this) !((initialValueType) != null && initialValueType.IsByReference) ) { nbv.ReplaceChild(nbv.InitialValue, new JSStructCopyExpression(nbv.InitialValue)); } VisitChildren(nbv); }
public void VisitNode (JSNewBoxedVariable nbv) { GenericParameter relevantParameter; var initialValue = nbv.InitialValue; var initialValueDerefed = initialValue; while (initialValueDerefed is JSReferenceExpression) initialValueDerefed = ((JSReferenceExpression)initialValueDerefed).Referent; var initialValueType = initialValueDerefed.GetActualType(TypeSystem); if ( IsCopyNeeded(nbv.InitialValue, out relevantParameter) && // We don't need to make a copy if the source value is a reference (like T& this) !((initialValueType) != null && initialValueType.IsByReference) ) { nbv.ReplaceChild(nbv.InitialValue, new JSStructCopyExpression(nbv.InitialValue)); } VisitChildren(nbv); }