@@ -317,42 +317,39 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)
317317 _baseTypeNamespace = "FrooxEngine.FrooxEngine.ProtoFlux." ;
318318 }
319319
320- if ( ! node . AttributeLists . Any ( ) )
320+ if ( node . AttributeLists . Any ( ) ) // if has any attributes
321321 {
322- base . VisitClassDeclaration ( node ) ;
323- return ;
324- }
322+ // category
323+ var nodeCategoryAttr = node . AttributeLists . SelectMany ( i => i . Attributes )
324+ . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeCategory" ) ;
325325
326- var find = node . AttributeLists . SelectMany ( i => i . Attributes )
327- . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeCategory" ) ;
326+ if ( nodeCategoryAttr ? . ArgumentList is not null )
327+ {
328+ _category = nodeCategoryAttr . ArgumentList . Arguments . First ( ) . ToString ( ) . TrimEnds ( 1 , 1 ) ;
329+ }
328330
329- _genericTypesAttribute = node . AttributeLists . FirstOrDefault ( attrList => attrList . Attributes . Any ( attr => attr . Name . ToString ( ) == "GenericTypes" ) ) ? . ToString ( ) ;
331+ // generic types
332+ _genericTypesAttribute = node . AttributeLists . FirstOrDefault ( attrList => attrList . Attributes . Any ( attr => attr . Name . ToString ( ) == "GenericTypes" ) ) ? . ToString ( ) ;
330333
331- _oldTypeNameAttribute = node . AttributeLists . FirstOrDefault ( attrList => attrList . Attributes . Any ( attr => attr . Name . ToString ( ) == "OldTypeName" ) ) ? . ToString ( ) ;
334+ // old type name
335+ _oldTypeNameAttribute = node . AttributeLists . FirstOrDefault ( attrList => attrList . Attributes . Any ( attr => attr . Name . ToString ( ) == "OldTypeName" ) ) ? . ToString ( ) ;
332336
333- if ( find ? . ArgumentList is null )
334- {
335- base . VisitClassDeclaration ( node ) ;
336- return ;
337- }
338-
339- _category = find . ArgumentList . Arguments . First ( ) . ToString ( ) . TrimEnds ( 1 , 1 ) ;
340-
341- var findName = node . AttributeLists . SelectMany ( i => i . Attributes )
342- . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeName" ) ;
337+ // name
338+ var findName = node . AttributeLists . SelectMany ( i => i . Attributes )
339+ . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeName" ) ;
343340
341+ if ( findName ? . ArgumentList != null )
342+ _nodeNameOverride =
343+ $ " public override string NodeName => { findName . ArgumentList . Arguments . First ( ) . ToString ( ) } ;";
344344
345- if ( findName ? . ArgumentList != null )
346- _nodeNameOverride =
347- $ " public override string NodeName => { findName . ArgumentList . Arguments . First ( ) . ToString ( ) } ;";
348-
349- var findOverload = node . AttributeLists . SelectMany ( i => i . Attributes )
350- . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeOverload" ) ;
345+ // overload
346+ var findOverload = node . AttributeLists . SelectMany ( i => i . Attributes )
347+ . FirstOrDefault ( i => i . Name . ToString ( ) == "NodeOverload" ) ;
348+
349+ if ( findOverload ? . ArgumentList != null )
350+ _nodeOverloadAttribute = $ "[Grouping({ findOverload . ArgumentList . Arguments . First ( ) . ToString ( ) } )]";
351+ }
351352
352-
353- if ( findOverload ? . ArgumentList != null )
354- _nodeOverloadAttribute = $ "[Grouping({ findOverload . ArgumentList . Arguments . First ( ) . ToString ( ) } )]";
355-
356353 foreach ( var u in _usingDeclarations )
357354 {
358355 var fullNameSpace = "" ;
@@ -368,9 +365,9 @@ public override void VisitClassDeclaration(ClassDeclarationSyntax node)
368365 _match = match ;
369366 _fullBaseType = fullNameSpace ;
370367 _valid = true ;
371- base . VisitClassDeclaration ( node ) ;
372- return ;
368+ break ;
373369 }
370+
374371 base . VisitClassDeclaration ( node ) ;
375372 }
376373 }
0 commit comments