@@ -179,7 +179,8 @@ private void GenerateOperationInterface(in GeneratorExecutionContext context, In
179
179
identifier : SyntaxFactory . Identifier ( node . WrapperName ) ,
180
180
parameterList : SyntaxFactory . ParameterList ( ) ,
181
181
initializer : null ,
182
- body : SyntaxFactory . Block ( staticCtorStatements ) ) ) ;
182
+ body : SyntaxFactory . Block ( staticCtorStatements ) ,
183
+ expressionBody : null ) ) ;
183
184
184
185
// private IArgumentOperationWrapper(IOperation operation)
185
186
// {
@@ -203,7 +204,8 @@ private void GenerateOperationInterface(in GeneratorExecutionContext context, In
203
204
SyntaxKind . SimpleMemberAccessExpression ,
204
205
expression : SyntaxFactory . ThisExpression ( ) ,
205
206
name : SyntaxFactory . IdentifierName ( "operation" ) ) ,
206
- right : SyntaxFactory . IdentifierName ( "operation" ) ) ) ) ) ) ;
207
+ right : SyntaxFactory . IdentifierName ( "operation" ) ) ) ) ,
208
+ expressionBody : null ) ) ;
207
209
208
210
// public IOperation WrappedOperation => this.operation;
209
211
members = members . Add ( SyntaxFactory . PropertyDeclaration (
@@ -679,8 +681,14 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
679
681
identifier : SyntaxFactory . Identifier ( "OperationWrapperHelper" ) ,
680
682
parameterList : SyntaxFactory . ParameterList ( ) ,
681
683
initializer : null ,
682
- body : SyntaxFactory . Block ( staticCtorStatements ) ) ;
684
+ body : SyntaxFactory . Block ( staticCtorStatements ) ,
685
+ expressionBody : null ) ;
683
686
687
+ // /// <summary>
688
+ // /// Gets the type that is wrapped by the given wrapper.
689
+ // /// </summary>
690
+ // /// <param name="wrapperType">Type of the wrapper for which the wrapped type should be retrieved.</param>
691
+ // /// <returns>The wrapped type, or null if there is no info.</returns>
684
692
// internal static Type GetWrappedType(Type wrapperType)
685
693
// {
686
694
// if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))
@@ -727,6 +735,25 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
727
735
SyntaxFactory . ReturnStatement ( SyntaxFactory . LiteralExpression ( SyntaxKind . NullLiteralExpression ) ) ) ,
728
736
expressionBody : null ) ;
729
737
738
+ getWrappedType = getWrappedType . WithLeadingTrivia ( SyntaxFactory . TriviaList (
739
+ SyntaxFactory . Trivia ( SyntaxFactory . DocumentationComment (
740
+ SyntaxFactory . XmlText ( " " ) ,
741
+ SyntaxFactory . XmlSummaryElement (
742
+ SyntaxFactory . XmlNewLine ( Environment . NewLine ) ,
743
+ SyntaxFactory . XmlText ( " Gets the type that is wrapped by the given wrapper." ) ,
744
+ SyntaxFactory . XmlNewLine ( Environment . NewLine ) ,
745
+ SyntaxFactory . XmlText ( " " ) ) ,
746
+ SyntaxFactory . XmlNewLine ( Environment . NewLine ) ,
747
+ SyntaxFactory . XmlText ( " " ) ,
748
+ SyntaxFactory . XmlParamElement (
749
+ "wrapperType" ,
750
+ SyntaxFactory . XmlText ( "Type of the wrapper for which the wrapped type should be retrieved." ) ) ,
751
+ SyntaxFactory . XmlNewLine ( Environment . NewLine ) ,
752
+ SyntaxFactory . XmlText ( " " ) ,
753
+ SyntaxFactory . XmlReturnsElement (
754
+ SyntaxFactory . XmlText ( "The wrapped type, or null if there is no info." ) ) ,
755
+ SyntaxFactory . XmlNewLine ( Environment . NewLine ) . WithoutTrailingTrivia ( ) ) ) ) ) ;
756
+
730
757
var wrapperHelperClass = SyntaxFactory . ClassDeclaration (
731
758
attributeLists : default ,
732
759
modifiers : SyntaxTokenList . Create ( SyntaxFactory . Token ( SyntaxKind . InternalKeyword ) ) . Add ( SyntaxFactory . Token ( SyntaxKind . StaticKeyword ) ) ,
@@ -831,7 +858,7 @@ public DocumentData(XDocument document)
831
858
832
859
if ( ! operationKinds . TryGetValue ( node . Attribute ( "Name" ) . Value , out var kinds ) )
833
860
{
834
- kinds = ImmutableArray < ( string name , int value , string extraDescription ) > . Empty ;
861
+ kinds = ImmutableArray < ( string name , int value , string ? extraDescription ) > . Empty ;
835
862
}
836
863
837
864
var interfaceData = new InterfaceData ( this , node , kinds ) ;
@@ -847,7 +874,7 @@ public DocumentData(XDocument document)
847
874
848
875
if ( ! operationKinds . TryGetValue ( node . Attribute ( "Name" ) . Value , out var kinds ) )
849
876
{
850
- kinds = ImmutableArray < ( string name , int value , string extraDescription ) > . Empty ;
877
+ kinds = ImmutableArray < ( string name , int value , string ? extraDescription ) > . Empty ;
851
878
}
852
879
853
880
var interfaceData = new InterfaceData ( this , node , kinds ) ;
@@ -859,11 +886,11 @@ public DocumentData(XDocument document)
859
886
860
887
public ReadOnlyDictionary < string , InterfaceData > Interfaces { get ; }
861
888
862
- private static ImmutableDictionary < string , ImmutableArray < ( string name , int value , string extraDescription ) > > GetOperationKinds ( XDocument document )
889
+ private static ImmutableDictionary < string , ImmutableArray < ( string name , int value , string ? extraDescription ) > > GetOperationKinds ( XDocument document )
863
890
{
864
891
var skippedOperationKinds = GetSkippedOperationKinds ( document ) ;
865
892
866
- var builder = ImmutableDictionary . CreateBuilder < string , ImmutableArray < ( string name , int value , string extraDescription ) > > ( ) ;
893
+ var builder = ImmutableDictionary . CreateBuilder < string , ImmutableArray < ( string name , int value , string ? extraDescription ) > > ( ) ;
867
894
868
895
int operationKind = 0 ;
869
896
foreach ( var node in document . XPathSelectElements ( "/Tree/AbstractNode|/Tree/Node" ) )
@@ -886,7 +913,7 @@ public DocumentData(XDocument document)
886
913
}
887
914
else if ( explicitKind . XPathSelectElements ( "Entry" ) . Any ( ) )
888
915
{
889
- var nodeBuilder = ImmutableArray . CreateBuilder < ( string name , int value , string extraDescription ) > ( ) ;
916
+ var nodeBuilder = ImmutableArray . CreateBuilder < ( string name , int value , string ? extraDescription ) > ( ) ;
890
917
foreach ( var entry in explicitKind . XPathSelectElements ( "Entry" ) )
891
918
{
892
919
if ( entry . Attribute ( "EditorBrowsable" ) ? . Value == "false" )
@@ -918,7 +945,7 @@ public DocumentData(XDocument document)
918
945
919
946
var nodeName = node . Attribute ( "Name" ) . Value ;
920
947
var kindName = nodeName . Substring ( "I" . Length , nodeName . Length - "I" . Length - "Operation" . Length ) ;
921
- builder . Add ( nodeName , ImmutableArray . Create ( ( kindName , operationKind , ( string ) null ) ) ) ;
948
+ builder . Add ( nodeName , ImmutableArray . Create ( ( kindName , operationKind , ( string ? ) null ) ) ) ;
922
949
}
923
950
924
951
return builder . ToImmutable ( ) ;
@@ -955,7 +982,7 @@ private sealed class InterfaceData
955
982
{
956
983
private readonly DocumentData documentData ;
957
984
958
- public InterfaceData ( DocumentData documentData , XElement node , ImmutableArray < ( string name , int value , string extraDescription ) > operationKinds )
985
+ public InterfaceData ( DocumentData documentData , XElement node , ImmutableArray < ( string name , int value , string ? extraDescription ) > operationKinds )
959
986
{
960
987
this . documentData = documentData ;
961
988
@@ -968,7 +995,7 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s
968
995
this . Properties = node . XPathSelectElements ( "Property" ) . Select ( property => new PropertyData ( property ) ) . ToImmutableArray ( ) ;
969
996
}
970
997
971
- public ImmutableArray < ( string name , int value , string extraDescription ) > OperationKinds { get ; }
998
+ public ImmutableArray < ( string name , int value , string ? extraDescription ) > OperationKinds { get ; }
972
999
973
1000
public string InterfaceName { get ; }
974
1001
@@ -982,7 +1009,7 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s
982
1009
983
1010
public ImmutableArray < PropertyData > Properties { get ; }
984
1011
985
- public InterfaceData BaseInterface
1012
+ public InterfaceData ? BaseInterface
986
1013
{
987
1014
get
988
1015
{
0 commit comments