@@ -179,7 +179,8 @@ private void GenerateOperationInterface(in GeneratorExecutionContext context, In
179179 identifier : SyntaxFactory . Identifier ( node . WrapperName ) ,
180180 parameterList : SyntaxFactory . ParameterList ( ) ,
181181 initializer : null ,
182- body : SyntaxFactory . Block ( staticCtorStatements ) ) ) ;
182+ body : SyntaxFactory . Block ( staticCtorStatements ) ,
183+ expressionBody : null ) ) ;
183184
184185 // private IArgumentOperationWrapper(IOperation operation)
185186 // {
@@ -203,7 +204,8 @@ private void GenerateOperationInterface(in GeneratorExecutionContext context, In
203204 SyntaxKind . SimpleMemberAccessExpression ,
204205 expression : SyntaxFactory . ThisExpression ( ) ,
205206 name : SyntaxFactory . IdentifierName ( "operation" ) ) ,
206- right : SyntaxFactory . IdentifierName ( "operation" ) ) ) ) ) ) ;
207+ right : SyntaxFactory . IdentifierName ( "operation" ) ) ) ) ,
208+ expressionBody : null ) ) ;
207209
208210 // public IOperation WrappedOperation => this.operation;
209211 members = members . Add ( SyntaxFactory . PropertyDeclaration (
@@ -679,8 +681,14 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
679681 identifier : SyntaxFactory . Identifier ( "OperationWrapperHelper" ) ,
680682 parameterList : SyntaxFactory . ParameterList ( ) ,
681683 initializer : null ,
682- body : SyntaxFactory . Block ( staticCtorStatements ) ) ;
684+ body : SyntaxFactory . Block ( staticCtorStatements ) ,
685+ expressionBody : null ) ;
683686
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>
684692 // internal static Type GetWrappedType(Type wrapperType)
685693 // {
686694 // if (WrappedTypes.TryGetValue(wrapperType, out Type wrappedType))
@@ -727,6 +735,25 @@ private void GenerateOperationWrapperHelper(in GeneratorExecutionContext context
727735 SyntaxFactory . ReturnStatement ( SyntaxFactory . LiteralExpression ( SyntaxKind . NullLiteralExpression ) ) ) ,
728736 expressionBody : null ) ;
729737
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+
730757 var wrapperHelperClass = SyntaxFactory . ClassDeclaration (
731758 attributeLists : default ,
732759 modifiers : SyntaxTokenList . Create ( SyntaxFactory . Token ( SyntaxKind . InternalKeyword ) ) . Add ( SyntaxFactory . Token ( SyntaxKind . StaticKeyword ) ) ,
@@ -831,7 +858,7 @@ public DocumentData(XDocument document)
831858
832859 if ( ! operationKinds . TryGetValue ( node . Attribute ( "Name" ) . Value , out var kinds ) )
833860 {
834- kinds = ImmutableArray < ( string name , int value , string extraDescription ) > . Empty ;
861+ kinds = ImmutableArray < ( string name , int value , string ? extraDescription ) > . Empty ;
835862 }
836863
837864 var interfaceData = new InterfaceData ( this , node , kinds ) ;
@@ -847,7 +874,7 @@ public DocumentData(XDocument document)
847874
848875 if ( ! operationKinds . TryGetValue ( node . Attribute ( "Name" ) . Value , out var kinds ) )
849876 {
850- kinds = ImmutableArray < ( string name , int value , string extraDescription ) > . Empty ;
877+ kinds = ImmutableArray < ( string name , int value , string ? extraDescription ) > . Empty ;
851878 }
852879
853880 var interfaceData = new InterfaceData ( this , node , kinds ) ;
@@ -859,11 +886,11 @@ public DocumentData(XDocument document)
859886
860887 public ReadOnlyDictionary < string , InterfaceData > Interfaces { get ; }
861888
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 )
863890 {
864891 var skippedOperationKinds = GetSkippedOperationKinds ( document ) ;
865892
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 ) > > ( ) ;
867894
868895 int operationKind = 0 ;
869896 foreach ( var node in document . XPathSelectElements ( "/Tree/AbstractNode|/Tree/Node" ) )
@@ -886,7 +913,7 @@ public DocumentData(XDocument document)
886913 }
887914 else if ( explicitKind . XPathSelectElements ( "Entry" ) . Any ( ) )
888915 {
889- var nodeBuilder = ImmutableArray . CreateBuilder < ( string name , int value , string extraDescription ) > ( ) ;
916+ var nodeBuilder = ImmutableArray . CreateBuilder < ( string name , int value , string ? extraDescription ) > ( ) ;
890917 foreach ( var entry in explicitKind . XPathSelectElements ( "Entry" ) )
891918 {
892919 if ( entry . Attribute ( "EditorBrowsable" ) ? . Value == "false" )
@@ -918,7 +945,7 @@ public DocumentData(XDocument document)
918945
919946 var nodeName = node . Attribute ( "Name" ) . Value ;
920947 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 ) ) ) ;
922949 }
923950
924951 return builder . ToImmutable ( ) ;
@@ -955,7 +982,7 @@ private sealed class InterfaceData
955982 {
956983 private readonly DocumentData documentData ;
957984
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 )
959986 {
960987 this . documentData = documentData ;
961988
@@ -968,7 +995,7 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s
968995 this . Properties = node . XPathSelectElements ( "Property" ) . Select ( property => new PropertyData ( property ) ) . ToImmutableArray ( ) ;
969996 }
970997
971- public ImmutableArray < ( string name , int value , string extraDescription ) > OperationKinds { get ; }
998+ public ImmutableArray < ( string name , int value , string ? extraDescription ) > OperationKinds { get ; }
972999
9731000 public string InterfaceName { get ; }
9741001
@@ -982,7 +1009,7 @@ public InterfaceData(DocumentData documentData, XElement node, ImmutableArray<(s
9821009
9831010 public ImmutableArray < PropertyData > Properties { get ; }
9841011
985- public InterfaceData BaseInterface
1012+ public InterfaceData ? BaseInterface
9861013 {
9871014 get
9881015 {
0 commit comments