@@ -328,7 +328,7 @@ public void GenerateCode(SourceProductionContext context)
328328 InvocationExpression ( MemberAccessExpression (
329329 SyntaxKind . SimpleMemberAccessExpression ,
330330 IdentifierName ( "global::TedToolkit.Quantities.Internal" ) ,
331- IdentifierName ( "GetFormat " ) ) )
331+ IdentifierName ( "ParseFormat " ) ) )
332332 . WithArgumentList ( ArgumentList (
333333 [
334334 Argument ( IdentifierName ( "format" ) ) ,
@@ -374,7 +374,7 @@ public void GenerateCode(SourceProductionContext context)
374374 InvocationExpression ( MemberAccessExpression (
375375 SyntaxKind . SimpleMemberAccessExpression ,
376376 IdentifierName ( "global::TedToolkit.Quantities.Internal" ) ,
377- IdentifierName ( "GetFormat " ) ) )
377+ IdentifierName ( "ParseFormat " ) ) )
378378 . WithArgumentList ( ArgumentList (
379379 [
380380 Argument ( IdentifierName ( "format" ) ) ,
@@ -520,7 +520,7 @@ public void GenerateCode(SourceProductionContext context)
520520 MethodDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) , Identifier ( "Equals" ) )
521521 . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) ) )
522522 . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
523- . WithXmlComment ( )
523+ . WithXmlCommentInheritDoc ( ( string ? ) null )
524524 . WithParameterList ( ParameterList (
525525 [
526526 Parameter ( Identifier ( "other" ) )
@@ -534,11 +534,12 @@ public void GenerateCode(SourceProductionContext context)
534534 Argument ( IdentifierName ( "other" ) )
535535 ] ) ) ) )
536536 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
537+
537538 MethodDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) , Identifier ( "Equals" ) )
538539 . WithModifiers (
539540 TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . OverrideKeyword ) ) )
540541 . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
541- . WithXmlComment ( )
542+ . WithXmlCommentInheritDoc ( ( string ? ) null )
542543 . WithParameterList ( ParameterList (
543544 [
544545 Parameter ( Identifier ( "obj" ) )
@@ -555,11 +556,12 @@ public void GenerateCode(SourceProductionContext context)
555556 Argument ( IdentifierName ( "other" ) )
556557 ] ) ) ) ) )
557558 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
559+
558560 MethodDeclaration ( PredefinedType ( Token ( SyntaxKind . IntKeyword ) ) , Identifier ( "GetHashCode" ) )
559561 . WithModifiers (
560562 TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . OverrideKeyword ) ) )
561563 . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
562- . WithXmlComment ( )
564+ . WithXmlCommentInheritDoc ( ( string ? ) null )
563565 . WithExpressionBody (
564566 ArrowExpressionClause (
565567 InvocationExpression (
@@ -568,6 +570,7 @@ public void GenerateCode(SourceProductionContext context)
568570 IdentifierName ( "Value" ) ,
569571 IdentifierName ( "GetHashCode" ) ) ) ) )
570572 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
573+
571574 MethodDeclaration ( PredefinedType ( Token ( SyntaxKind . IntKeyword ) ) , Identifier ( "CompareTo" ) )
572575 . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) ) )
573576 . WithParameterList ( ParameterList (
@@ -576,7 +579,7 @@ public void GenerateCode(SourceProductionContext context)
576579 . WithType ( IdentifierName ( quantity . Name ) )
577580 ] ) )
578581 . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
579- . WithXmlComment ( )
582+ . WithXmlCommentInheritDoc ( ( string ? ) null )
580583 . WithExpressionBody ( ArrowExpressionClause ( InvocationExpression (
581584 IdentifierName ( "Tolerance.CurrentDefault.Compare" ) )
582585 . WithArgumentList ( ArgumentList (
@@ -586,6 +589,153 @@ public void GenerateCode(SourceProductionContext context)
586589 ] ) ) ) )
587590 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
588591
592+ MethodDeclaration ( PredefinedType ( Token ( SyntaxKind . IntKeyword ) ) , Identifier ( "CompareTo" ) )
593+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) ) )
594+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
595+ . WithXmlCommentInheritDoc ( ( string ? ) null )
596+ . WithParameterList ( ParameterList (
597+ [
598+ Parameter ( Identifier ( "obj" ) )
599+ . WithType ( NullableType ( PredefinedType ( Token ( SyntaxKind . ObjectKeyword ) ) ) )
600+ ] ) )
601+ . WithExpressionBody ( ArrowExpressionClause (
602+ InvocationExpression ( MemberAccessExpression (
603+ SyntaxKind . SimpleMemberAccessExpression ,
604+ IdentifierName ( "global::TedToolkit.Quantities.Internal" ) ,
605+ IdentifierName ( "CompareTo" ) ) )
606+ . WithArgumentList ( ArgumentList (
607+ [
608+ Argument ( ThisExpression ( ) ) ,
609+ Argument ( IdentifierName ( "obj" ) )
610+ ] ) ) ) )
611+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
612+
613+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
614+ Token ( SyntaxKind . EqualsEqualsToken ) )
615+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
616+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
617+ . WithXmlComment ( )
618+ . WithParameterList ( ParameterList (
619+ [
620+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
621+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
622+ ] ) )
623+ . WithExpressionBody ( ArrowExpressionClause (
624+ InvocationExpression ( MemberAccessExpression ( SyntaxKind . SimpleMemberAccessExpression ,
625+ IdentifierName ( "left" ) , IdentifierName ( "Equals" ) ) )
626+ . WithArgumentList ( ArgumentList (
627+ [
628+ Argument ( IdentifierName ( "right" ) )
629+ ] ) ) ) )
630+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
631+
632+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
633+ Token ( SyntaxKind . ExclamationEqualsToken ) )
634+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
635+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
636+ . WithXmlComment ( )
637+ . WithParameterList ( ParameterList (
638+ [
639+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
640+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
641+ ] ) )
642+ . WithExpressionBody ( ArrowExpressionClause (
643+ PrefixUnaryExpression (
644+ SyntaxKind . LogicalNotExpression ,
645+ ParenthesizedExpression (
646+ BinaryExpression (
647+ SyntaxKind . EqualsExpression ,
648+ IdentifierName ( "left" ) ,
649+ IdentifierName ( "right" ) ) ) ) ) )
650+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
651+
652+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
653+ Token ( SyntaxKind . GreaterThanToken ) )
654+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
655+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
656+ . WithXmlComment ( )
657+ . WithParameterList ( ParameterList (
658+ [
659+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
660+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
661+ ] ) )
662+ . WithExpressionBody ( ArrowExpressionClause (
663+ BinaryExpression ( SyntaxKind . GreaterThanExpression ,
664+ InvocationExpression ( MemberAccessExpression (
665+ SyntaxKind . SimpleMemberAccessExpression ,
666+ IdentifierName ( "left" ) , IdentifierName ( "CompareTo" ) ) )
667+ . WithArgumentList ( ArgumentList (
668+ [
669+ Argument ( IdentifierName ( "right" ) )
670+ ] ) ) ,
671+ LiteralExpression ( SyntaxKind . NumericLiteralExpression , Literal ( 0 ) ) ) ) )
672+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
673+
674+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
675+ Token ( SyntaxKind . LessThanToken ) )
676+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
677+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
678+ . WithXmlComment ( )
679+ . WithParameterList ( ParameterList (
680+ [
681+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
682+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
683+ ] ) )
684+ . WithExpressionBody ( ArrowExpressionClause (
685+ BinaryExpression ( SyntaxKind . LessThanExpression ,
686+ InvocationExpression ( MemberAccessExpression (
687+ SyntaxKind . SimpleMemberAccessExpression ,
688+ IdentifierName ( "left" ) , IdentifierName ( "CompareTo" ) ) )
689+ . WithArgumentList ( ArgumentList (
690+ [
691+ Argument ( IdentifierName ( "right" ) )
692+ ] ) ) ,
693+ LiteralExpression ( SyntaxKind . NumericLiteralExpression , Literal ( 0 ) ) ) ) )
694+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
695+
696+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
697+ Token ( SyntaxKind . GreaterThanEqualsToken ) )
698+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
699+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
700+ . WithXmlComment ( )
701+ . WithParameterList ( ParameterList (
702+ [
703+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
704+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
705+ ] ) )
706+ . WithExpressionBody ( ArrowExpressionClause (
707+ BinaryExpression ( SyntaxKind . GreaterThanOrEqualExpression ,
708+ InvocationExpression ( MemberAccessExpression (
709+ SyntaxKind . SimpleMemberAccessExpression ,
710+ IdentifierName ( "left" ) , IdentifierName ( "CompareTo" ) ) )
711+ . WithArgumentList ( ArgumentList (
712+ [
713+ Argument ( IdentifierName ( "right" ) )
714+ ] ) ) ,
715+ LiteralExpression ( SyntaxKind . NumericLiteralExpression , Literal ( 0 ) ) ) ) )
716+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
717+
718+ OperatorDeclaration ( PredefinedType ( Token ( SyntaxKind . BoolKeyword ) ) ,
719+ Token ( SyntaxKind . LessThanEqualsToken ) )
720+ . WithModifiers ( TokenList ( Token ( SyntaxKind . PublicKeyword ) , Token ( SyntaxKind . StaticKeyword ) ) )
721+ . WithAttributeLists ( [ GeneratedCodeAttribute ( typeof ( QuantityStructGenerator ) ) ] )
722+ . WithXmlComment ( )
723+ . WithParameterList ( ParameterList (
724+ [
725+ Parameter ( Identifier ( "left" ) ) . WithType ( IdentifierName ( quantity . Name ) ) ,
726+ Parameter ( Identifier ( "right" ) ) . WithType ( IdentifierName ( quantity . Name ) )
727+ ] ) )
728+ . WithExpressionBody ( ArrowExpressionClause (
729+ BinaryExpression ( SyntaxKind . LessThanOrEqualExpression ,
730+ InvocationExpression ( MemberAccessExpression (
731+ SyntaxKind . SimpleMemberAccessExpression ,
732+ IdentifierName ( "left" ) , IdentifierName ( "CompareTo" ) ) )
733+ . WithArgumentList ( ArgumentList (
734+ [
735+ Argument ( IdentifierName ( "right" ) )
736+ ] ) ) ,
737+ LiteralExpression ( SyntaxKind . NumericLiteralExpression , Literal ( 0 ) ) ) ) )
738+ . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
589739 #endregion
590740
591741 #region Operators
@@ -598,9 +748,9 @@ public void GenerateCode(SourceProductionContext context)
598748 Parameter ( Identifier ( "value" ) ) . WithType ( IdentifierName ( quantity . Name ) )
599749 ] ) )
600750 . WithExpressionBody ( ArrowExpressionClause ( CastExpression ( IdentifierName ( quantity . Name ) ,
601- ParenthesizedExpression ( PrefixUnaryExpression ( SyntaxKind . UnaryMinusExpression ,
602- MemberAccessExpression ( SyntaxKind . SimpleMemberAccessExpression ,
603- IdentifierName ( "value" ) , IdentifierName ( "Value" ) ) ) ) ) ) )
751+ ParenthesizedExpression ( PrefixUnaryExpression ( SyntaxKind . UnaryMinusExpression ,
752+ MemberAccessExpression ( SyntaxKind . SimpleMemberAccessExpression ,
753+ IdentifierName ( "value" ) , IdentifierName ( "Value" ) ) ) ) ) ) )
604754 . WithSemicolonToken ( Token ( SyntaxKind . SemicolonToken ) ) ,
605755
606756 OperatorDeclaration ( IdentifierName ( quantity . Name ) , Token ( SyntaxKind . PlusToken ) )
0 commit comments