Created
May 5, 2011 01:19
-
-
Save kg/956348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void VisitNode (JSBinaryOperatorExpression boe) { | |
if (boe.Operator != JSOperator.Assignment) { | |
base.VisitNode(boe); | |
return; | |
} | |
if (IsStruct(boe.Left.GetExpectedType(TypeSystem)) || IsStruct(boe.Right.GetExpectedType(TypeSystem))) { | |
Debug.WriteLine(String.Format("struct assignment {0} = {1}", boe.Left, boe.Right)); | |
if (boe.Right is JSLiteral) { | |
Debug.WriteLine(" copy not needed, literal"); | |
} else if (boe.Right is JSInvocationExpression) { | |
Debug.WriteLine(" copy not needed, invocation result"); | |
} else { | |
Debug.WriteLine(" copy introduced"); | |
boe.Right = new JSInvocationExpression(new JSDotExpression(boe.Right, CLR.MemberwiseClone)); | |
} | |
} | |
VisitChildren(boe); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment