@@ -106,11 +106,9 @@ internal static string GetTemplate(string snippet, string type)
106106 static string GetSnippet ( string file )
107107 {
108108 string content ;
109- using ( var reader = new StreamReader ( File . OpenRead ( file ) ) )
110- {
111- content = reader . ReadToEnd ( ) ;
112- reader . Close ( ) ;
113- }
109+ using var reader = new StreamReader ( File . OpenRead ( file ) ) ;
110+ content = reader . ReadToEnd ( ) ;
111+ reader . Close ( ) ;
114112 return content ;
115113 }
116114
@@ -127,27 +125,24 @@ internal static KeyValuePair<string, string> GetVarNameToQualifiedName(ASResult
127125 var sci = PluginBase . MainForm . CurrentDocument . SciControl ;
128126 var lineNum = sci . CurrentLine ;
129127 var word = Reflector . ASGenerator . GetStatementReturnType ( sci , sci . GetLine ( lineNum ) , sci . PositionFromLine ( lineNum ) ) ? . Word ;
130- var varname = string . Empty ;
131- if ( member ? . Name != null ) varname = Reflector . ASGenerator . GuessVarName ( member . Name , type ) ;
128+ var value = string . Empty ;
129+ if ( member ? . Name != null ) value = Reflector . ASGenerator . GuessVarName ( member . Name , type ) ;
132130 if ( ! string . IsNullOrEmpty ( word ) && char . IsDigit ( word [ 0 ] ) ) word = null ;
133131 if ( ! string . IsNullOrEmpty ( word ) && ( string . IsNullOrEmpty ( type ) || Regex . IsMatch ( type , "(<[^]]+>)" ) ) ) word = null ;
134132 if ( ! string . IsNullOrEmpty ( type ) && type == ASContext . Context . Features . voidKey ) type = null ;
135- if ( string . IsNullOrEmpty ( varname ) ) varname = Reflector . ASGenerator . GuessVarName ( word , type ) ;
136- if ( ! string . IsNullOrEmpty ( varname ) && varname == word ) varname = $ "{ varname } 1";
137- return new KeyValuePair < string , string > ( varname , type ) ;
133+ if ( string . IsNullOrEmpty ( value ) ) value = Reflector . ASGenerator . GuessVarName ( word , type ) ;
134+ if ( ! string . IsNullOrEmpty ( value ) && value == word ) value = $ "{ value } 1";
135+ return new KeyValuePair < string , string > ( value , type ) ;
138136 }
139137
140138 internal static string ProcessTemplate ( string pattern , string template , ASResult expr )
141139 {
142- switch ( pattern )
140+ return pattern switch
143141 {
144- case PatternCollection :
145- return ProcessCollectionTemplate ( template , expr ) ;
146- case PatternHash :
147- return ProcessHashTemplate ( template , expr ) ;
148- default :
149- return template ;
150- }
142+ PatternCollection => ProcessCollectionTemplate ( template , expr ) ,
143+ PatternHash => ProcessHashTemplate ( template , expr ) ,
144+ _ => template
145+ } ;
151146 }
152147
153148 internal static string ProcessMemberTemplate ( string template , ASResult expr )
0 commit comments