resharper/resharper-yaml/src/Yaml/Psi/Tree/Impl/ChameleonDocumentBody.cs [218:252]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AssertTextLength(openedChameleon); DeleteChildRange(firstChild, lastChild); OpenChameleonFrom(openedChameleon); } private void OpenChameleonFrom([NotNull] ITreeNode openedChameleon) { Assertion.Assert(firstChild == null && lastChild == null, "firstChild == null && lastChild == null"); ITreeNode child; while ((child = openedChameleon.FirstChild) != null) { ((CompositeElement) openedChameleon).DeleteChildRange(child, child); AppendNewChild((TreeElement) child); } myOpened = true; } [Conditional("JET_MODE_ASSERT")] private void AssertSingleChild() { if (firstChild == lastChild && firstChild is IClosedChameleonBody) return; Assertion.Fail("One ChameleonElement child but found also {0}", lastChild.NodeType); } [Conditional("JET_MODE_ASSERT")] private void AssertTextLength(ITreeNode openedChameleon) { var expectedTextLength = firstChild.GetTextLength(); var actualTextLength = openedChameleon.GetTextLength(); Assertion.Assert(expectedTextLength == actualTextLength, "Chameleon length differ after opening! {0} {1}", expectedTextLength, actualTextLength); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - resharper/resharper-yaml/src/Yaml/Psi/Tree/Impl/ChameleonMapValueNode.cs [140:174]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AssertTextLength(openedChameleon); DeleteChildRange(firstChild, lastChild); OpenChameleonFrom(openedChameleon); } private void OpenChameleonFrom([NotNull] ITreeNode openedChameleon) { Assertion.Assert(firstChild == null && lastChild == null, "firstChild == null && lastChild == null"); ITreeNode child; while ((child = openedChameleon.FirstChild) != null) { ((CompositeElement) openedChameleon).DeleteChildRange(child, child); AppendNewChild((TreeElement) child); } myOpened = true; } [Conditional("JET_MODE_ASSERT")] private void AssertSingleChild() { if (firstChild == lastChild && firstChild is IClosedChameleonBody) return; Assertion.Fail("One ChameleonElement child but found also {0}", lastChild.NodeType); } [Conditional("JET_MODE_ASSERT")] private void AssertTextLength(ITreeNode openedChameleon) { var expectedTextLength = firstChild.GetTextLength(); var actualTextLength = openedChameleon.GetTextLength(); Assertion.Assert(expectedTextLength == actualTextLength, "Chameleon length differ after opening! {0} {1}", expectedTextLength, actualTextLength); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -