@@ -186,7 +186,7 @@ class StringStream {
186186 }
187187
188188 public next ( ) : string {
189- var next = this . peek ( ) ;
189+ const next = this . peek ( ) ;
190190 this . advance ( ) ;
191191 return next ;
192192 }
@@ -219,7 +219,7 @@ interface IFormatParseTree {
219219}
220220
221221function _renderFormattedText ( element : Node , treeNode : IFormatParseTree , actionCallback ?: ( content : string , event ?: IMouseEvent ) => void ) {
222- var child : Node ;
222+ let child : Node ;
223223
224224 if ( treeNode . type === FormatType . Text ) {
225225 child = document . createTextNode ( treeNode . content ) ;
@@ -231,7 +231,7 @@ function _renderFormattedText(element: Node, treeNode: IFormatParseTree, actionC
231231 child = document . createElement ( 'i' ) ;
232232 }
233233 else if ( treeNode . type === FormatType . Action ) {
234- var a = document . createElement ( 'a' ) ;
234+ const a = document . createElement ( 'a' ) ;
235235 a . href = '#' ;
236236 DOM . addStandardDisposableListener ( a , 'click' , ( event ) => {
237237 actionCallback ( String ( treeNode . index ) , event ) ;
@@ -259,20 +259,20 @@ function _renderFormattedText(element: Node, treeNode: IFormatParseTree, actionC
259259
260260function parseFormattedText ( content : string ) : IFormatParseTree {
261261
262- var root : IFormatParseTree = {
262+ const root : IFormatParseTree = {
263263 type : FormatType . Root ,
264264 children : [ ]
265265 } ;
266266
267- var actionItemIndex = 0 ;
268- var current = root ;
269- var stack : IFormatParseTree [ ] = [ ] ;
270- var stream = new StringStream ( content ) ;
267+ let actionItemIndex = 0 ;
268+ let current = root ;
269+ const stack : IFormatParseTree [ ] = [ ] ;
270+ const stream = new StringStream ( content ) ;
271271
272272 while ( ! stream . eos ( ) ) {
273- var next = stream . next ( ) ;
273+ let next = stream . next ( ) ;
274274
275- var isEscapedFormatType = ( next === '\\' && formatTagType ( stream . peek ( ) ) !== FormatType . Invalid ) ;
275+ const isEscapedFormatType = ( next === '\\' && formatTagType ( stream . peek ( ) ) !== FormatType . Invalid ) ;
276276 if ( isEscapedFormatType ) {
277277 next = stream . next ( ) ; // unread the backslash if it escapes a format tag type
278278 }
@@ -284,11 +284,11 @@ function parseFormattedText(content: string): IFormatParseTree {
284284 current = stack . pop ( ) ;
285285 }
286286
287- var type = formatTagType ( next ) ;
287+ const type = formatTagType ( next ) ;
288288 if ( current . type === type || ( current . type === FormatType . Action && type === FormatType . ActionClose ) ) {
289289 current = stack . pop ( ) ;
290290 } else {
291- var newCurrent : IFormatParseTree = {
291+ const newCurrent : IFormatParseTree = {
292292 type : type ,
293293 children : [ ]
294294 } ;
@@ -313,7 +313,7 @@ function parseFormattedText(content: string): IFormatParseTree {
313313
314314 } else {
315315 if ( current . type !== FormatType . Text ) {
316- var textCurrent : IFormatParseTree = {
316+ const textCurrent : IFormatParseTree = {
317317 type : FormatType . Text ,
318318 content : next
319319 } ;
0 commit comments