File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public interface IAstVisited
13
13
14
14
public interface IAstVisitor < out T > : ITypeVisitor < T > , IDeclVisitor < T >
15
15
{
16
-
16
+ AstVisitorOptions VisitOptions { get ; }
17
17
}
18
18
19
19
public class AstVisitorOptions
@@ -23,6 +23,7 @@ public class AstVisitorOptions
23
23
public bool VisitClassProperties = true ;
24
24
public bool VisitClassMethods = true ;
25
25
public bool VisitClassTemplateSpecializations { get ; set ; } = true ;
26
+ public bool VisitPropertyAccessors = false ;
26
27
27
28
public bool VisitNamespaceEnums = true ;
28
29
public bool VisitNamespaceTemplates = true ;
@@ -376,7 +377,16 @@ public virtual bool VisitProperty(Property property)
376
377
return false ;
377
378
378
379
if ( VisitOptions . VisitFunctionReturnType )
379
- return property . Type . Visit ( this ) ;
380
+ property . Type . Visit ( this ) ;
381
+
382
+ if ( VisitOptions . VisitPropertyAccessors )
383
+ {
384
+ if ( property . GetMethod != null )
385
+ property . GetMethod . Visit ( this ) ;
386
+
387
+ if ( property . SetMethod != null )
388
+ property . SetMethod . Visit ( this ) ;
389
+ }
380
390
381
391
return true ;
382
392
}
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ public virtual CommentKind CommentKind
46
46
47
47
public ISet < object > Visited { get ; } = new HashSet < object > ( ) ;
48
48
49
+ public AstVisitorOptions VisitOptions { get ; } = new AstVisitorOptions ( ) ;
50
+
49
51
protected CodeGenerator ( BindingContext context , TranslationUnit unit )
50
52
: this ( context , new List < TranslationUnit > { unit } )
51
53
{
@@ -331,7 +333,19 @@ public virtual bool VisitEvent(Event @event)
331
333
332
334
public virtual bool VisitProperty ( Property property )
333
335
{
334
- throw new NotImplementedException ( ) ;
336
+ if ( ! VisitDeclaration ( property ) )
337
+ return false ;
338
+
339
+ if ( VisitOptions . VisitPropertyAccessors )
340
+ {
341
+ if ( property . GetMethod != null )
342
+ property . GetMethod . Visit ( this ) ;
343
+
344
+ if ( property . SetMethod != null )
345
+ property . SetMethod . Visit ( this ) ;
346
+ }
347
+
348
+ return true ;
335
349
}
336
350
337
351
public virtual bool VisitFriend ( Friend friend )
You can’t perform that action at this time.
0 commit comments