@@ -87,18 +87,20 @@ bool TryBuildPropertySetCodeBlock(Declaration prototype,
87
87
/// No validation or conflict analysis is applied to the identifiers.
88
88
/// </remarks>
89
89
/// <param name="prototype">DeclarationType with flags: Variable, Constant, UserDefinedTypeMember, or Function</param>
90
- bool TryBuildUDTMemberDeclaration ( string identifier , Declaration prototype , out string declaration ) ;
90
+ bool TryBuildUDTMemberDeclaration ( Declaration prototype , string identifier , out string declaration ) ;
91
+
92
+ IIndenter Indenter { get ; }
91
93
}
92
94
93
95
public class CodeBuilder : ICodeBuilder
94
96
{
95
- private readonly IIndenter _indenter ;
96
-
97
97
public CodeBuilder ( IIndenter indenter )
98
98
{
99
- _indenter = indenter ;
99
+ Indenter = indenter ;
100
100
}
101
101
102
+ public IIndenter Indenter { get ; }
103
+
102
104
public string BuildMemberBlockFromPrototype ( ModuleBodyElementDeclaration declaration ,
103
105
string content = null ,
104
106
Accessibility accessibility = Accessibility . Public ,
@@ -135,6 +137,9 @@ private bool TryBuildPropertyBlockFromTarget<T>(T prototype, DeclarationType let
135
137
136
138
var propertyValueParam = parameterIdentifier ?? Resources . Refactorings . Refactorings . CodeBuilder_DefaultPropertyRHSParam ;
137
139
140
+ //TODO: Improve generated Array properties
141
+ //Add logic to conditionally return Arrays or Variant depending on Office version.
142
+ //Ability to return an Array from a Function or Property was added in Office 2000 http://www.cpearson.com/excel/passingandreturningarrays.htm
138
143
var asType = prototype . IsArray
139
144
? $ "{ Tokens . Variant } "
140
145
: IsEnumField ( prototype ) && prototype . AsTypeDeclaration . Accessibility . Equals ( Accessibility . Private )
@@ -151,7 +156,7 @@ private bool TryBuildPropertyBlockFromTarget<T>(T prototype, DeclarationType let
151
156
? string . Join ( Environment . NewLine , $ "{ AccessibilityToken ( accessibility ) } { TypeToken ( letSetGetType ) } { propertyIdentifier } () { asTypeClause } ", content , EndStatement ( letSetGetType ) )
152
157
: string . Join ( Environment . NewLine , $ "{ AccessibilityToken ( accessibility ) } { TypeToken ( letSetGetType ) } { propertyIdentifier } ({ letSetParamExpression } )", content , EndStatement ( letSetGetType ) ) ;
153
158
154
- codeBlock = string . Join ( Environment . NewLine , _indenter . Indent ( codeBlock ) ) ;
159
+ codeBlock = string . Join ( Environment . NewLine , Indenter . Indent ( codeBlock ) ) ;
155
160
return true ;
156
161
}
157
162
@@ -270,12 +275,12 @@ public bool TryBuildUserDefinedTypeDeclaration(string udtIdentifier, IEnumerable
270
275
271
276
blockLines . Add ( $ "{ Tokens . End } { Tokens . Type } ") ;
272
277
273
- declaration = string . Join ( Environment . NewLine , _indenter . Indent ( blockLines ) ) ;
278
+ declaration = string . Join ( Environment . NewLine , Indenter . Indent ( blockLines ) ) ;
274
279
275
280
return true ;
276
281
}
277
282
278
- public bool TryBuildUDTMemberDeclaration ( string udtMemberIdentifier , Declaration prototype , out string declaration )
283
+ public bool TryBuildUDTMemberDeclaration ( Declaration prototype , string udtMemberIdentifier , out string declaration )
279
284
{
280
285
declaration = string . Empty ;
281
286
0 commit comments