@@ -746,7 +746,7 @@ private MethodDeclarationResult BuildMethodDeclaration(
746
746
function . AddParameter ( parameter ) ;
747
747
if ( parameterNode . Modifiers . IsOutOrRef ( ) ) {
748
748
refOrOutParameters . Add ( parameter ) ;
749
- } else if ( parameterNode . Modifiers . IsParams ( ) && symbol . HasParamsAttribute ( ) ) {
749
+ } else if ( parameterNode . Modifiers . IsParams ( ) && generator_ . HasParamsAttribute ( symbol ) ) {
750
750
function . ParameterList . Parameters [ ^ 1 ] = LuaSyntaxNode . Tokens . Params ;
751
751
}
752
752
}
@@ -807,8 +807,8 @@ private bool IsCurTypeSerializable {
807
807
}
808
808
}
809
809
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 ) ;
812
812
}
813
813
814
814
public override LuaSyntaxNode VisitMethodDeclaration ( MethodDeclarationSyntax node ) {
@@ -902,7 +902,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
902
902
bool isImmutable = typeSymbol . IsImmutable ( ) ;
903
903
foreach ( var variable in node . Declaration . Variables ) {
904
904
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 ) ) {
906
906
continue ;
907
907
}
908
908
@@ -917,7 +917,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
917
917
typeExpression = GetTypeName ( eventSymbol . ContainingType ) ;
918
918
}
919
919
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 ) ) {
921
921
AddPropertyOrEventMetaData ( variableSymbol , new PropertyMethodResult ( add ) , new PropertyMethodResult ( remove ) , null , attributes ) ;
922
922
}
923
923
continue ;
@@ -933,7 +933,7 @@ private void VisitBaseFieldDeclarationSyntax(BaseFieldDeclarationSyntax node) {
933
933
isMoreThanUpValueStaticInit = IsMoreThanUpValueStaticInitField ( variableSymbol ) ;
934
934
}
935
935
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 ) ) {
937
937
if ( variableSymbol . Kind == SymbolKind . Field ) {
938
938
AddFieldMetaData ( ( IFieldSymbol ) variableSymbol , fieldName , attributes ) ;
939
939
} else {
@@ -1064,7 +1064,7 @@ private void AddPropertyOrEventMetaData(ISymbol symbol, PropertyMethodResult get
1064
1064
1065
1065
public override LuaSyntaxNode VisitPropertyDeclaration ( PropertyDeclarationSyntax node ) {
1066
1066
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 ) ) {
1068
1068
bool isStatic = symbol . IsStatic ;
1069
1069
bool isPrivate = generator_ . IsPrivate ( symbol ) && symbol . ExplicitInterfaceImplementations . IsEmpty ;
1070
1070
bool hasGet = false ;
@@ -1162,7 +1162,7 @@ public override LuaSyntaxNode VisitPropertyDeclaration(PropertyDeclarationSyntax
1162
1162
}
1163
1163
}
1164
1164
1165
- if ( IsCurTypeSerializable || attributes . Count > 0 || symbol . HasMetadataAttribute ( ) ) {
1165
+ if ( IsCurTypeSerializable || attributes . Count > 0 || generator_ . HasMetadataAttribute ( symbol ) ) {
1166
1166
AddPropertyOrEventMetaData ( symbol , getMethod , setMethod , propertyName , attributes ) ;
1167
1167
}
1168
1168
}
@@ -1176,7 +1176,7 @@ private bool IsReadOnlyProperty(PropertyDeclarationSyntax node) {
1176
1176
1177
1177
public override LuaSyntaxNode VisitEventDeclaration ( EventDeclarationSyntax node ) {
1178
1178
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 ) ) {
1180
1180
var attributes = BuildAttributes ( node . AttributeLists ) ;
1181
1181
bool isStatic = symbol . IsStatic ;
1182
1182
bool isPrivate = symbol . IsPrivate ( ) && symbol . ExplicitInterfaceImplementations . IsEmpty ;
@@ -1209,7 +1209,7 @@ public override LuaSyntaxNode VisitEventDeclaration(EventDeclarationSyntax node)
1209
1209
}
1210
1210
}
1211
1211
1212
- if ( attributes . Count > 0 || symbol . HasMetadataAttribute ( ) ) {
1212
+ if ( attributes . Count > 0 || generator_ . HasMetadataAttribute ( symbol ) ) {
1213
1213
AddPropertyOrEventMetaData ( symbol , addMethod , removeMethod , null , attributes ) ;
1214
1214
}
1215
1215
}
@@ -1226,7 +1226,7 @@ public override LuaSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSy
1226
1226
Contract . Assert ( symbol . HasConstantValue ) ;
1227
1227
LuaIdentifierNameSyntax identifier = node . Identifier . ValueText ;
1228
1228
var attributes = BuildAttributes ( node . AttributeLists ) ;
1229
- if ( IsCurTypeSerializable || attributes . Count > 0 || CurTypeSymbol . HasMetadataAttribute ( ) ) {
1229
+ if ( IsCurTypeSerializable || attributes . Count > 0 || generator_ . HasMetadataAttribute ( CurTypeSymbol ) ) {
1230
1230
AddFieldMetaData ( symbol , identifier , attributes ) ;
1231
1231
}
1232
1232
var value = new LuaIdentifierLiteralExpressionSyntax ( symbol . ConstantValue . ToString ( ) ) ;
@@ -1235,7 +1235,7 @@ public override LuaSyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSy
1235
1235
1236
1236
public override LuaSyntaxNode VisitIndexerDeclaration ( IndexerDeclarationSyntax node ) {
1237
1237
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 ) ) {
1239
1239
bool isPrivate = symbol . IsPrivate ( ) ;
1240
1240
var indexName = GetMemberName ( symbol ) ;
1241
1241
var parameterList = node . ParameterList . Accept < LuaParameterListSyntax > ( this ) ;
@@ -2479,7 +2479,7 @@ private void CheckInvocationDefaultArguments(
2479
2479
}
2480
2480
} else if ( ! parameters . IsEmpty ) {
2481
2481
IParameterSymbol last = parameters . Last ( ) ;
2482
- if ( last . IsParams && generator_ . IsFromLuaModule ( symbol ) && ! symbol . HasParamsAttribute ( ) ) {
2482
+ if ( last . IsParams && generator_ . IsFromLuaModule ( symbol ) && ! generator_ . HasParamsAttribute ( symbol ) ) {
2483
2483
if ( parameters . Length == arguments . Count ) {
2484
2484
var paramsArgument = argumentNodeInfos . Last ( ) ;
2485
2485
if ( paramsArgument . Name != null ) {
@@ -2905,7 +2905,7 @@ private bool IsEventAddOrRemoveIdentifierName(IdentifierNameSyntax node) {
2905
2905
}
2906
2906
2907
2907
private bool IsPropertyField ( IdentifierNameSyntax node , IPropertySymbol propertySymbol ) {
2908
- return IsPropertyField ( propertySymbol ) || ( IsInternalNode ( node ) && propertySymbol . IsAutoProperty ( ) ) ;
2908
+ return IsPropertyField ( propertySymbol ) || ( IsInternalNode ( node ) && generator_ . IsAutoProperty ( propertySymbol ) ) ;
2909
2909
}
2910
2910
2911
2911
private LuaExpressionSyntax VisitPropertyOrEventIdentifierName ( IdentifierNameSyntax node , ISymbol symbol , bool isProperty , out bool isField ) {
@@ -2915,7 +2915,7 @@ private LuaExpressionSyntax VisitPropertyOrEventIdentifierName(IdentifierNameSyn
2915
2915
isField = IsPropertyField ( node , propertySymbol ) ;
2916
2916
isReadOnly = propertySymbol . IsReadOnly ;
2917
2917
if ( IsPropertyTemplate ( propertySymbol ) ) {
2918
- var ( get , set ) = Utility . GetPropertyTemplateFromAttribute ( symbol ) ;
2918
+ var ( get , set ) = generator_ . GetPropertyTemplateFromAttribute ( symbol ) ;
2919
2919
return new LuaPropertyTemplateExpressionSyntax ( get , set ) ;
2920
2920
}
2921
2921
} else {
@@ -3322,7 +3322,7 @@ LuaIdentifierNameSyntax GetSampleName(ISymbol nodeSymbol) {
3322
3322
}
3323
3323
case SymbolKind . Field : {
3324
3324
var fieldSymbol = ( IFieldSymbol ) symbol ;
3325
- var codeTemplate = fieldSymbol . GetCodeTemplateFromAttribute ( ) ;
3325
+ var codeTemplate = generator_ . GetCodeTemplateFromAttribute ( fieldSymbol ) ;
3326
3326
if ( codeTemplate != null ) {
3327
3327
identifier = BuildCodeTemplateExpression ( codeTemplate , fieldSymbol . IsStatic ? null : LuaIdentifierNameSyntax . This ) ;
3328
3328
break ;
0 commit comments