@@ -746,7 +746,7 @@ private MethodDeclarationResult BuildMethodDeclaration(
746746 function . AddParameter ( parameter ) ;
747747 if ( parameterNode . Modifiers . IsOutOrRef ( ) ) {
748748 refOrOutParameters . Add ( parameter ) ;
749- } else if ( parameterNode . Modifiers . IsParams ( ) && symbol . HasParamsAttribute ( ) ) {
749+ } else if ( parameterNode . Modifiers . IsParams ( ) && generator_ . HasParamsAttribute ( symbol ) ) {
750750 function . ParameterList . Parameters [ ^ 1 ] = LuaSyntaxNode . Tokens . Params ;
751751 }
752752 }
@@ -807,8 +807,8 @@ private bool IsCurTypeSerializable {
807807 }
808808 }
809809
810- private static bool IsExportMethodDeclaration ( BaseMethodDeclarationSyntax node ) {
811- return ( node . Body != null || node . ExpressionBody != null ) && ! node . HasCSharpLuaAttribute ( LuaDocumentStatement . AttributeFlags . Ignore ) ;
810+ private bool IsExportMethodDeclaration ( BaseMethodDeclarationSyntax node ) {
811+ return ( node . Body != null || node . ExpressionBody != null ) && ! generator_ . HasCSharpLuaAttribute ( node , LuaDocumentStatement . AttributeFlags . Ignore ) ;
812812 }
813813
814814 public override LuaSyntaxNode VisitMethodDeclaration ( MethodDeclarationSyntax node ) {
@@ -902,7 +902,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
902902 bool isImmutable = typeSymbol . IsImmutable ( ) ;
903903 foreach ( var variable in node . Declaration . Variables ) {
904904 var variableSymbol = semanticModel_ . GetDeclaredSymbol ( variable ) ;
905- if ( variableSymbol . IsAbstract || variableSymbol . IsExtern || variableSymbol . GetDeclaringSyntaxNode ( ) . HasCSharpLuaAttribute ( LuaDocumentStatement . AttributeFlags . Ignore ) ) {
905+ if ( variableSymbol . IsAbstract || variableSymbol . IsExtern || generator_ . HasCSharpLuaAttribute ( variableSymbol . GetDeclaringSyntaxNode ( ) , LuaDocumentStatement . AttributeFlags . Ignore ) ) {
906906 continue ;
907907 }
908908
@@ -917,7 +917,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
917917 typeExpression = GetTypeName ( eventSymbol . ContainingType ) ;
918918 }
919919 var ( add , remove ) = CurType . AddEvent ( eventName , innerName , valueExpression , isImmutable && valueIsLiteral , isStatic , eventSymbol . IsPrivate ( ) , typeExpression , statements ) ;
920- if ( attributes . Count > 0 || variableSymbol . HasMetadataAttribute ( ) ) {
920+ if ( attributes . Count > 0 || generator_ . HasMetadataAttribute ( variableSymbol ) ) {
921921 AddPropertyOrEventMetaData ( variableSymbol , new PropertyMethodResult ( add ) , new PropertyMethodResult ( remove ) , null , attributes ) ;
922922 }
923923 continue ;
@@ -933,7 +933,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
933933 isMoreThanUpValueStaticInit = IsMoreThanUpValueStaticInitField ( variableSymbol ) ;
934934 }
935935 AddField ( fieldName , typeSymbol , value , isImmutable , isStatic , isPrivate , isReadOnly , isMoreThanLocalVariables , isMoreThanUpValueStaticInit ) ;
936- if ( IsCurTypeSerializable || attributes . Count > 0 || variableSymbol . HasMetadataAttribute ( ) ) {
936+ if ( IsCurTypeSerializable || attributes . Count > 0 || generator_ . HasMetadataAttribute ( variableSymbol ) ) {
937937 if ( variableSymbol . Kind == SymbolKind . Field ) {
938938 AddFieldMetaData ( ( IFieldSymbol ) variableSymbol , fieldName , attributes ) ;
939939 } else {
@@ -1064,7 +1064,7 @@ private void AddPropertyOrEventMetaData(ISymbol symbol, PropertyMethodResult get
10641064
10651065 public override LuaSyntaxNode VisitPropertyDeclaration ( PropertyDeclarationSyntax node ) {
10661066 var symbol = semanticModel_ . GetDeclaredSymbol ( node ) ;
1067- if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! symbol . GetDeclaringSyntaxNode ( ) . HasCSharpLuaAttribute ( LuaDocumentStatement . AttributeFlags . Ignore ) ) {
1067+ if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! generator_ . HasCSharpLuaAttribute ( symbol . GetDeclaringSyntaxNode ( ) , LuaDocumentStatement . AttributeFlags . Ignore ) ) {
10681068 bool isStatic = symbol . IsStatic ;
10691069 bool isPrivate = generator_ . IsPrivate ( symbol ) && symbol . ExplicitInterfaceImplementations . IsEmpty ;
10701070 bool hasGet = false ;
@@ -1162,7 +1162,7 @@ public override LuaSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax
11621162 }
11631163 }
11641164
1165- if ( IsCurTypeSerializable || attributes . Count > 0 || symbol . HasMetadataAttribute ( ) ) {
1165+ if ( IsCurTypeSerializable || attributes . Count > 0 || generator_ . HasMetadataAttribute ( symbol ) ) {
11661166 AddPropertyOrEventMetaData ( symbol , getMethod , setMethod , propertyName , attributes ) ;
11671167 }
11681168 }
@@ -1176,7 +1176,7 @@ private bool IsReadOnlyProperty(PropertyDeclarationSyntax node) {
11761176
11771177 public override LuaSyntaxNode VisitEventDeclaration ( EventDeclarationSyntax node ) {
11781178 var symbol = semanticModel_ . GetDeclaredSymbol ( node ) ;
1179- if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! symbol . GetDeclaringSyntaxNode ( ) . HasCSharpLuaAttribute ( LuaDocumentStatement . AttributeFlags . Ignore ) ) {
1179+ if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! generator_ . HasCSharpLuaAttribute ( symbol . GetDeclaringSyntaxNode ( ) , LuaDocumentStatement . AttributeFlags . Ignore ) ) {
11801180 var attributes = BuildAttributes ( node . AttributeLists ) ;
11811181 bool isStatic = symbol . IsStatic ;
11821182 bool isPrivate = symbol . IsPrivate ( ) && symbol . ExplicitInterfaceImplementations . IsEmpty ;
@@ -1209,7 +1209,7 @@ public override LuaSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node)
12091209 }
12101210 }
12111211
1212- if ( attributes . Count > 0 || symbol . HasMetadataAttribute ( ) ) {
1212+ if ( attributes . Count > 0 || generator_ . HasMetadataAttribute ( symbol ) ) {
12131213 AddPropertyOrEventMetaData ( symbol , addMethod , removeMethod , null , attributes ) ;
12141214 }
12151215 }
@@ -1226,7 +1226,7 @@ public override LuaSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSy
12261226 Contract . Assert ( symbol . HasConstantValue ) ;
12271227 LuaIdentifierNameSyntax identifier = node . Identifier . ValueText ;
12281228 var attributes = BuildAttributes ( node . AttributeLists ) ;
1229- if ( IsCurTypeSerializable || attributes . Count > 0 || CurTypeSymbol . HasMetadataAttribute ( ) ) {
1229+ if ( IsCurTypeSerializable || attributes . Count > 0 || generator_ . HasMetadataAttribute ( CurTypeSymbol ) ) {
12301230 AddFieldMetaData ( symbol , identifier , attributes ) ;
12311231 }
12321232 var value = new LuaIdentifierLiteralExpressionSyntax ( symbol . ConstantValue . ToString ( ) ) ;
@@ -1235,7 +1235,7 @@ public override LuaSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSy
12351235
12361236 public override LuaSyntaxNode VisitIndexerDeclaration ( IndexerDeclarationSyntax node ) {
12371237 var symbol = semanticModel_ . GetDeclaredSymbol ( node ) ;
1238- if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! symbol . GetDeclaringSyntaxNode ( ) . HasCSharpLuaAttribute ( LuaDocumentStatement . AttributeFlags . Ignore ) ) {
1238+ if ( ! symbol . IsAbstract && ! symbol . IsExtern && ! generator_ . HasCSharpLuaAttribute ( symbol . GetDeclaringSyntaxNode ( ) , LuaDocumentStatement . AttributeFlags . Ignore ) ) {
12391239 bool isPrivate = symbol . IsPrivate ( ) ;
12401240 var indexName = GetMemberName ( symbol ) ;
12411241 var parameterList = node . ParameterList . Accept < LuaParameterListSyntax > ( this ) ;
@@ -2479,7 +2479,7 @@ private void CheckInvocationDefaultArguments(
24792479 }
24802480 } else if ( ! parameters . IsEmpty ) {
24812481 IParameterSymbol last = parameters . Last ( ) ;
2482- if ( last . IsParams && generator_ . IsFromLuaModule ( symbol ) && ! symbol . HasParamsAttribute ( ) ) {
2482+ if ( last . IsParams && generator_ . IsFromLuaModule ( symbol ) && ! generator_ . HasParamsAttribute ( symbol ) ) {
24832483 if ( parameters . Length == arguments . Count ) {
24842484 var paramsArgument = argumentNodeInfos . Last ( ) ;
24852485 if ( paramsArgument . Name != null ) {
@@ -2905,7 +2905,7 @@ private bool IsEventAddOrRemoveIdentifierName(IdentifierNameSyntax node) {
29052905 }
29062906
29072907 private bool IsPropertyField ( IdentifierNameSyntax node , IPropertySymbol propertySymbol ) {
2908- return IsPropertyField ( propertySymbol ) || ( IsInternalNode ( node ) && propertySymbol . IsAutoProperty ( ) ) ;
2908+ return IsPropertyField ( propertySymbol ) || ( IsInternalNode ( node ) && generator_ . IsAutoProperty ( propertySymbol ) ) ;
29092909 }
29102910
29112911 private LuaExpressionSyntax VisitPropertyOrEventIdentifierName ( IdentifierNameSyntax node , ISymbol symbol , bool isProperty , out bool isField ) {
@@ -2915,7 +2915,7 @@ private LuaExpressionSyntax VisitPropertyOrEventIdentifierName(IdentifierNameSyn
29152915 isField = IsPropertyField ( node , propertySymbol ) ;
29162916 isReadOnly = propertySymbol . IsReadOnly ;
29172917 if ( IsPropertyTemplate ( propertySymbol ) ) {
2918- var ( get , set ) = Utility . GetPropertyTemplateFromAttribute ( symbol ) ;
2918+ var ( get , set ) = generator_ . GetPropertyTemplateFromAttribute ( symbol ) ;
29192919 return new LuaPropertyTemplateExpressionSyntax ( get , set ) ;
29202920 }
29212921 } else {
@@ -3322,7 +3322,7 @@ LuaIdentifierNameSyntax GetSampleName(ISymbol nodeSymbol) {
33223322 }
33233323 case SymbolKind . Field : {
33243324 var fieldSymbol = ( IFieldSymbol ) symbol ;
3325- var codeTemplate = fieldSymbol . GetCodeTemplateFromAttribute ( ) ;
3325+ var codeTemplate = generator_ . GetCodeTemplateFromAttribute ( fieldSymbol ) ;
33263326 if ( codeTemplate != null ) {
33273327 identifier = BuildCodeTemplateExpression ( codeTemplate , fieldSymbol . IsStatic ? null : LuaIdentifierNameSyntax . This ) ;
33283328 break ;
0 commit comments