@@ -58,35 +58,35 @@ export interface QueryPredicate<T> {
58
58
* - values collected based on a predicate
59
59
* - `QueryList` to which collected values should be reported
60
60
*/
61
- export interface LQuery < T > {
62
- /**
63
- * Next query. Used when queries are stored as a linked list in `LQueries`.
64
- */
65
- next : LQuery < any > | null ;
66
-
67
- /**
68
- * Destination to which the value should be added.
69
- */
70
- list : QueryList < T > ;
71
-
72
- /**
73
- * A predicate which determines if a given element/directive should be included in the query
74
- * results.
75
- */
76
- predicate : QueryPredicate < T > ;
77
-
78
- /**
79
- * Values which have been located.
80
- *
81
- * This is what builds up the `QueryList._valuesTree`.
82
- */
83
- values : any [ ] ;
84
-
85
- /**
86
- * A pointer to an array that stores collected values from views. This is necessary so we know a
87
- * container into which to insert nodes collected from views.
88
- */
89
- containerValues : any [ ] | null ;
61
+ class LQuery < T > {
62
+ constructor (
63
+ /**
64
+ * Next query. Used when queries are stored as a linked list in `LQueries`.
65
+ */
66
+ public next : LQuery < any > | null ,
67
+
68
+ /**
69
+ * Destination to which the value should be added.
70
+ */
71
+ public list : QueryList < T > ,
72
+
73
+ /**
74
+ * A predicate which determines if a given element/directive should be included in the query
75
+ * results.
76
+ */
77
+ public predicate : QueryPredicate < T > ,
78
+
79
+ /**
80
+ * Values which have been located.
81
+ * This is what builds up the `QueryList._valuesTree`.
82
+ */
83
+ public values : any [ ] ,
84
+
85
+ /**
86
+ * A pointer to an array that stores collected values from views. This is necessary so we
87
+ * know a container into which to insert nodes collected from views.
88
+ */
89
+ public containerValues : any [ ] | null ) { }
90
90
}
91
91
92
92
export class LQueries_ implements LQueries {
@@ -145,14 +145,7 @@ function copyQueriesToContainer(query: LQuery<any>| null): LQuery<any>|null {
145
145
while ( query ) {
146
146
const containerValues : any [ ] = [ ] ; // prepare room for views
147
147
query . values . push ( containerValues ) ;
148
- const clonedQuery : LQuery < any > = {
149
- next : result ,
150
- list : query . list ,
151
- predicate : query . predicate ,
152
- values : containerValues ,
153
- containerValues : null
154
- } ;
155
- result = clonedQuery ;
148
+ result = new LQuery < any > ( result , query . list , query . predicate , containerValues , null ) ;
156
149
query = query . next ;
157
150
}
158
151
@@ -163,14 +156,7 @@ function copyQueriesToView(query: LQuery<any>| null): LQuery<any>|null {
163
156
let result : LQuery < any > | null = null ;
164
157
165
158
while ( query ) {
166
- const clonedQuery : LQuery < any > = {
167
- next : result ,
168
- list : query . list ,
169
- predicate : query . predicate ,
170
- values : [ ] ,
171
- containerValues : query . values
172
- } ;
173
- result = clonedQuery ;
159
+ result = new LQuery < any > ( result , query . list , query . predicate , [ ] , query . values ) ;
174
160
query = query . next ;
175
161
}
176
162
@@ -349,13 +335,9 @@ function createPredicate<T>(predicate: Type<T>| string[], read: Type<T>| null):
349
335
function createLQuery < T > (
350
336
previous : LQuery < any > | null , queryList : QueryList < T > , predicate : Type < T > | string [ ] ,
351
337
read : Type < T > | null ) : LQuery < T > {
352
- return {
353
- next : previous ,
354
- list : queryList ,
355
- predicate : createPredicate ( predicate , read ) ,
356
- values : ( queryList as any as QueryList_ < T > ) . _valuesTree ,
357
- containerValues : null
358
- } ;
338
+ return new LQuery (
339
+ previous , queryList , createPredicate ( predicate , read ) ,
340
+ ( queryList as any as QueryList_ < T > ) . _valuesTree , null ) ;
359
341
}
360
342
361
343
type QueryList_ < T > = QueryList < T > & { _valuesTree : any [ ] , _static : boolean } ;
0 commit comments