Mark some fields as readonly and reuse index value in RemoveChild

Summary:
Mark some fields as readonly and reuse index value in RemoveChild.
Closes https://github.com/facebook/yoga/pull/516

Reviewed By: emilsjolander

Differential Revision: D4921809

Pulled By: splhack

fbshipit-source-id: 261a7910675d93be165c16ee53a83c02b15925f1
This commit is contained in:
Lukas Wöhrl
2017-04-25 11:27:29 -07:00
committed by Facebook Github Bot
parent 0684795a89
commit f2b5d0fef7

View File

@@ -26,8 +26,8 @@ namespace Facebook.Yoga
{
public partial class YogaNode : IEnumerable<YogaNode>
{
private Native.YGNodeHandle _ygNode;
private YogaConfig _config;
private readonly Native.YGNodeHandle _ygNode;
private readonly YogaConfig _config;
private WeakReference _parent;
private List<YogaNode> _children;
private MeasureFunction _measureFunction;
@@ -586,7 +586,7 @@ namespace Facebook.Yoga
int index = IndexOf(child);
if (index >= 0)
{
RemoveAt(IndexOf(child));
RemoveAt(index);
}
}