@@ -29,17 +29,16 @@ public IncludeExpression Parse(string source, ResourceType resourceType)
2929
3030 Tokenize ( source ) ;
3131
32- IncludeExpression expression = ParseInclude ( source , resourceType ) ;
32+ IncludeExpression expression = ParseInclude ( resourceType ) ;
3333
3434 AssertTokenStackIsEmpty ( ) ;
3535 ValidateMaximumIncludeDepth ( expression , 0 ) ;
3636
3737 return expression ;
3838 }
3939
40- protected virtual IncludeExpression ParseInclude ( string source , ResourceType resourceType )
40+ protected virtual IncludeExpression ParseInclude ( ResourceType resourceType )
4141 {
42- ArgumentNullException . ThrowIfNull ( source ) ;
4342 ArgumentNullException . ThrowIfNull ( resourceType ) ;
4443
4544 var treeRoot = IncludeTreeNode . CreateRoot ( resourceType ) ;
@@ -56,13 +55,13 @@ protected virtual IncludeExpression ParseInclude(string source, ResourceType res
5655 isAtStart = false ;
5756 }
5857
59- ParseRelationshipChain ( source , treeRoot ) ;
58+ ParseRelationshipChain ( treeRoot ) ;
6059 }
6160
6261 return treeRoot . ToExpression ( ) ;
6362 }
6463
65- private void ParseRelationshipChain ( string source , IncludeTreeNode treeRoot )
64+ private void ParseRelationshipChain ( IncludeTreeNode treeRoot )
6665 {
6766 // A relationship name usually matches a single relationship, even when overridden in derived types.
6867 // But in the following case, two relationships are matched on GET /shoppingBaskets?include=items:
@@ -90,30 +89,29 @@ private void ParseRelationshipChain(string source, IncludeTreeNode treeRoot)
9089 // that there's currently no way to include Products without Articles. We could add such optional upcast syntax
9190 // in the future, if desired.
9291
93- ReadOnlyCollection < IncludeTreeNode > children = ParseRelationshipName ( source , [ treeRoot ] ) ;
92+ ReadOnlyCollection < IncludeTreeNode > children = ParseRelationshipName ( [ treeRoot ] ) ;
9493
9594 while ( TokenStack . TryPeek ( out Token ? nextToken ) && nextToken . Kind == TokenKind . Period )
9695 {
9796 EatSingleCharacterToken ( TokenKind . Period ) ;
9897
99- children = ParseRelationshipName ( source , children ) ;
98+ children = ParseRelationshipName ( children ) ;
10099 }
101100 }
102101
103- private ReadOnlyCollection < IncludeTreeNode > ParseRelationshipName ( string source , IReadOnlyCollection < IncludeTreeNode > parents )
102+ private ReadOnlyCollection < IncludeTreeNode > ParseRelationshipName ( IReadOnlyCollection < IncludeTreeNode > parents )
104103 {
105104 int position = GetNextTokenPositionOrEnd ( ) ;
106105
107106 if ( TokenStack . TryPop ( out Token ? token ) && token . Kind == TokenKind . Text )
108107 {
109- return LookupRelationshipName ( token . Value ! , parents , source , position ) ;
108+ return LookupRelationshipName ( token . Value ! , parents , position ) ;
110109 }
111110
112111 throw new QueryParseException ( "Relationship name expected." , position ) ;
113112 }
114113
115- private static ReadOnlyCollection < IncludeTreeNode > LookupRelationshipName ( string relationshipName , IReadOnlyCollection < IncludeTreeNode > parents ,
116- string source , int position )
114+ private ReadOnlyCollection < IncludeTreeNode > LookupRelationshipName ( string relationshipName , IReadOnlyCollection < IncludeTreeNode > parents , int position )
117115 {
118116 List < IncludeTreeNode > children = [ ] ;
119117 HashSet < RelationshipAttribute > relationshipsFound = [ ] ;
@@ -135,7 +133,7 @@ private static ReadOnlyCollection<IncludeTreeNode> LookupRelationshipName(string
135133 }
136134
137135 AssertRelationshipsFound ( relationshipsFound , relationshipName , parents , position ) ;
138- AssertAtLeastOneCanBeIncluded ( relationshipsFound , relationshipName , source , position ) ;
136+ AssertAtLeastOneCanBeIncluded ( relationshipsFound , relationshipName , position ) ;
139137
140138 return children . AsReadOnly ( ) ;
141139 }
@@ -201,15 +199,15 @@ private static string GetErrorMessageForNoneFound(string relationshipName, Resou
201199 return builder . ToString ( ) ;
202200 }
203201
204- private static void AssertAtLeastOneCanBeIncluded ( HashSet < RelationshipAttribute > relationshipsFound , string relationshipName , string source , int position )
202+ private void AssertAtLeastOneCanBeIncluded ( HashSet < RelationshipAttribute > relationshipsFound , string relationshipName , int position )
205203 {
206204 if ( relationshipsFound . All ( relationship => relationship . IsIncludeBlocked ( ) ) )
207205 {
208206 ResourceType resourceType = relationshipsFound . First ( ) . LeftType ;
209207 string message = $ "Including the relationship '{ relationshipName } ' on '{ resourceType } ' is not allowed.";
210208
211209 var exception = new QueryParseException ( message , position ) ;
212- string specificMessage = exception . GetMessageWithPosition ( source ) ;
210+ string specificMessage = exception . GetMessageWithPosition ( Source ) ;
213211
214212 throw new InvalidQueryStringParameterException ( "include" , "The specified include is invalid." , specificMessage ) ;
215213 }
0 commit comments