@@ -120,14 +120,29 @@ export class CompileDiDependencyMetadata {
120120 }
121121
122122 static fromJson ( data : { [ key : string ] : any } ) : CompileDiDependencyMetadata {
123- return new CompileDiDependencyMetadata (
124- { token : objFromJson ( data [ 'token' ] , CompileIdentifierMetadata . fromJson ) } ) ;
123+ return new CompileDiDependencyMetadata ( {
124+ token : objFromJson ( data [ 'token' ] , CompileIdentifierMetadata . fromJson ) ,
125+ query : objFromJson ( data [ 'query' ] , CompileQueryMetadata . fromJson ) ,
126+ viewQuery : objFromJson ( data [ 'viewQuery' ] , CompileQueryMetadata . fromJson ) ,
127+ isAttribute : data [ 'isAttribute' ] ,
128+ isSelf : data [ 'isSelf' ] ,
129+ isHost : data [ 'isHost' ] ,
130+ isSkipSelf : data [ 'isSkipSelf' ] ,
131+ isOptional : data [ 'isOptional' ]
132+ } ) ;
125133 }
126134
127135 toJson ( ) : { [ key : string ] : any } {
128136 return {
129137 // Note: Runtime type can't be serialized...
130- 'token' : objToJson ( this . token )
138+ 'token' : objToJson ( this . token ) ,
139+ 'query' : objToJson ( this . query ) ,
140+ 'viewQuery' : objToJson ( this . viewQuery ) ,
141+ 'isAttribute' : this . isAttribute ,
142+ 'isSelf' : this . isSelf ,
143+ 'isHost' : this . isHost ,
144+ 'isSkipSelf' : this . isSkipSelf ,
145+ 'isOptional' : this . isOptional
131146 } ;
132147 }
133148}
@@ -274,9 +289,28 @@ export class CompileQueryMetadata {
274289 } = { } ) {
275290 this . selectors = selectors ;
276291 this . descendants = descendants ;
277- this . first = first ;
292+ this . first = normalizeBool ( first ) ;
278293 this . propertyName = propertyName ;
279294 }
295+
296+ static fromJson ( data : { [ key : string ] : any } ) : CompileQueryMetadata {
297+ return new CompileQueryMetadata ( {
298+ selectors : arrayFromJson ( data [ 'selectors' ] , CompileIdentifierMetadata . fromJson ) ,
299+ descendants : data [ 'descendants' ] ,
300+ first : data [ 'first' ] ,
301+ propertyName : data [ 'propertyName' ]
302+ } ) ;
303+ }
304+
305+ toJson ( ) : { [ key : string ] : any } {
306+ return {
307+ // Note: Runtime type can't be serialized...
308+ 'selectors' : arrayToJson ( this . selectors ) ,
309+ 'descendants' : this . descendants ,
310+ 'first' : this . first ,
311+ 'propertyName' : this . propertyName
312+ } ;
313+ }
280314}
281315
282316/**
@@ -581,11 +615,11 @@ var _COMPILE_METADATA_FROM_JSON = {
581615} ;
582616
583617function arrayFromJson ( obj : any [ ] , fn : ( a : { [ key : string ] : any } ) => any ) : any {
584- return isBlank ( obj ) ? null : obj . map ( fn ) ;
618+ return isBlank ( obj ) ? null : obj . map ( o => objFromJson ( o , fn ) ) ;
585619}
586620
587621function arrayToJson ( obj : any [ ] ) : string | { [ key : string ] : any } {
588- return isBlank ( obj ) ? null : obj . map ( o => o . toJson ( ) ) ;
622+ return isBlank ( obj ) ? null : obj . map ( objToJson ) ;
589623}
590624
591625function objFromJson ( obj : any , fn : ( a : { [ key : string ] : any } ) => any ) : any {
0 commit comments