private void WriteEnd(ScriptNode node) { if (_expectEnd) { HandleEos(node); bool triviasHasEnd = node.HasTrivia(ScriptTriviaType.End, false); if (_previousRawStatement != null) { _nextLStrip = GetWhitespaceModeFromTrivia(_previousRawStatement, false); } if (!_isInCode) { WriteEnterCode(); } if (triviasHasEnd) { WriteTrivias(node, false); } else { Write(_isInCode ? "end" : " end "); } if (!_isInCode) { WriteExitCode(); } else { _expectEndOfStatement = true; } _expectEnd = false; } else { WriteTrivias(node, false); } if (node is ScriptPage) { if (_isInCode) { WriteExitCode(); } } }