1- using Rubberduck . Parsing . Grammar ;
1+ using Rubberduck . Common ;
2+ using Rubberduck . Parsing . Grammar ;
23using Rubberduck . Parsing . Symbols ;
34using System ;
45using System . Collections . Generic ;
@@ -11,19 +12,13 @@ public interface ICodeBuilder
1112 /// <summary>
1213 /// Returns ModuleBodyElementDeclaration signature with an ImprovedArgument list
1314 /// </summary>
14- /// <param name="declaration"></param>
15- /// <returns></returns>
1615 string ImprovedFullMemberSignature ( ModuleBodyElementDeclaration declaration ) ;
1716
1817 /// <summary>
1918 /// Returns a ModuleBodyElementDeclaration block
2019 /// with an ImprovedArgument List
2120 /// </summary>
22- /// <param name="declaration"></param>
2321 /// <param name="content">Main body content/logic of the member</param>
24- /// <param name="accessibility"></param>
25- /// <param name="newIdentifier"></param>
26- /// <returns></returns>
2722 string BuildMemberBlockFromPrototype ( ModuleBodyElementDeclaration declaration ,
2823 string content = null ,
2924 string accessibility = null ,
@@ -34,19 +29,14 @@ string BuildMemberBlockFromPrototype(ModuleBodyElementDeclaration declaration,
3429 /// 1. Explicitly declares Property Let\Set value parameter as ByVal
3530 /// 2. Ensures UserDefined Type parameters are declared either explicitly or implicitly as ByRef
3631 /// </summary>
37- /// <param name="declaration"></param>
38- /// <returns></returns>
3932 string ImprovedArgumentList ( ModuleBodyElementDeclaration declaration ) ;
4033
4134 /// <summary>
4235 /// Generates a Property Get codeblock based on the prototype declaration
4336 /// </summary>
4437 /// <param name="prototype">VariableDeclaration or UserDefinedTypeMember</param>
45- /// <param name="propertyIdentifier"></param>
46- /// <param name="accessibility"></param>
4738 /// <param name="content">Member body content. Formatting is the responsibility of the caller</param>
48- /// <param name="parameterIdentifier">Defaults to 'value' unless otherwise specified</param>
49- /// <returns></returns>
39+ /// <param name="parameterIdentifier">Defaults to '<paramref name="propertyIdentifier"/>Value' unless otherwise specified</param>
5040 bool TryBuildPropertyGetCodeBlock ( Declaration prototype ,
5141 string propertyIdentifier ,
5242 out string codeBlock ,
@@ -57,11 +47,8 @@ bool TryBuildPropertyGetCodeBlock(Declaration prototype,
5747 /// Generates a Property Let codeblock based on the prototype declaration
5848 /// </summary>
5949 /// <param name="prototype">VariableDeclaration or UserDefinedTypeMember</param>
60- /// <param name="propertyIdentifier"></param>
61- /// <param name="accessibility"></param>
62- /// <param name="content">Membmer body content. Formatting is the responsibility of the caller</param>
63- /// <param name="parameterIdentifier">Defaults to 'value' unless otherwise specified</param>
64- /// <returns></returns>
50+ /// <param name="content">Member body content. Formatting is the responsibility of the caller</param>
51+ /// <param name="parameterIdentifier">Defaults to '<paramref name="propertyIdentifier"/>Value' unless otherwise specified</param>
6552 bool TryBuildPropertyLetCodeBlock ( Declaration prototype ,
6653 string propertyIdentifier ,
6754 out string codeBlock ,
@@ -73,21 +60,26 @@ bool TryBuildPropertyLetCodeBlock(Declaration prototype,
7360 /// Generates a Property Set codeblock based on the prototype declaration
7461 /// </summary>
7562 /// <param name="prototype">VariableDeclaration or UserDefinedTypeMember</param>
76- /// <param name="propertyIdentifier"></param>
77- /// <param name="accessibility"></param>
78- /// <param name="content">Membmer body content. Formatting is the responsibility of the caller</param>
79- /// <param name="parameterIdentifier">Defaults to 'value' unless otherwise specified</param>
80- /// <returns></returns>
63+ /// <param name="content">Member body content. Formatting is the responsibility of the caller</param>
64+ /// <param name="parameterIdentifier">Defaults to '<paramref name="propertyIdentifier"/>Value' unless otherwise specified</param>
8165 bool TryBuildPropertySetCodeBlock ( Declaration prototype ,
8266 string propertyIdentifier ,
8367 out string codeBlock ,
8468 string accessibility = null ,
8569 string content = null ,
8670 string parameterIdentifier = null ) ;
71+ /// <summary>
72+ /// Generates a default RHS property parameter IdentifierName
73+ /// </summary>
74+ /// <param name="propertyIdentifier">Let/Set Property IdentifierName</param>
75+ string BuildPropertyRhsParameterName ( string propertyIdentifier ) ;
8776 }
8877
8978 public class CodeBuilder : ICodeBuilder
9079 {
80+ public string BuildPropertyRhsParameterName ( string propertyIdentifier )
81+ => string . Format ( Resources . Refactorings . Refactorings . CodeBuilder_DefaultPropertyRHSParamFormat , propertyIdentifier . ToLowerCaseFirstLetter ( ) ) ;
82+
9183 public string BuildMemberBlockFromPrototype ( ModuleBodyElementDeclaration declaration ,
9284 string content = null ,
9385 string accessibility = null ,
@@ -127,7 +119,7 @@ private bool TryBuildPropertyBlockFromTarget<T>(T prototype, DeclarationType let
127119 return false ;
128120 }
129121
130- var propertyValueParam = parameterIdentifier ?? Resources . RubberduckUI . EncapsulateField_DefaultPropertyParameter ;
122+ var propertyValueParam = parameterIdentifier ?? BuildPropertyRhsParameterName ( propertyIdentifier ) ;
131123
132124 var asType = prototype . IsArray
133125 ? $ "{ Tokens . Variant } "
0 commit comments