@@ -55,24 +55,17 @@ export class BindTargetParser {
5555 filePath : string ,
5656 scope ?: BindTargetScope ,
5757 ) : BindTargetDeclaration {
58- const bindTargetDeclaration : BindTargetDeclaration = { } as BindTargetDeclaration ;
59-
60- // listen to children
61- bindTargetDeclaration . listenToChildren = unvalidatedBindTargetDeclaration . listenToChildren ;
62-
6358 // storage prop
64- bindTargetDeclaration . storageProp = new PropPath (
59+ const storageProp = new PropPath (
6560 unvalidatedBindTargetDeclaration . storageProp . map ( x => new PropAccess ( x . type , x . prop . value ) ) ,
6661 ) ;
6762
6863 // storage type
64+ let storageType : string ;
6965 if ( unvalidatedBindTargetDeclaration . storageType === undefined ) {
70- bindTargetDeclaration . storageType = this . mb . metadataManager . defaultSource ;
66+ storageType = this . mb . metadataManager . defaultSource ;
7167 } else {
72- bindTargetDeclaration . storageType = this . validateStorageType (
73- unvalidatedBindTargetDeclaration . storageType ,
74- fullDeclaration ,
75- ) ;
68+ storageType = this . validateStorageType ( unvalidatedBindTargetDeclaration . storageType , fullDeclaration ) ;
7669 }
7770
7871 // storage path
@@ -81,25 +74,28 @@ export class BindTargetParser {
8174 value : filePath ,
8275 } ;
8376
84- const source = this . mb . metadataManager . getSource ( bindTargetDeclaration . storageType ) ;
77+ const source = this . mb . metadataManager . getSource ( storageType ) ;
8578 if ( source === undefined ) {
8679 throw new MetaBindInternalError ( {
8780 errorLevel : ErrorLevel . CRITICAL ,
8881 effect : 'can not validate bind target' ,
89- cause : `Source '${ bindTargetDeclaration . storageType } ' not found. But validation was successful. This should not happen.` ,
82+ cause : `Source '${ storageType } ' not found. But validation was successful. This should not happen.` ,
9083 context : {
9184 fullDeclaration : fullDeclaration ,
9285 sources : [ ...this . mb . metadataManager . sources . keys ( ) ] ,
9386 } ,
9487 } ) ;
9588 }
9689
97- bindTargetDeclaration . storagePath = source . validateStoragePath (
98- storagePathToValidate ,
99- hadStoragePath ,
100- fullDeclaration ,
101- this ,
102- ) ;
90+ const storagePath = source . validateStoragePath ( storagePathToValidate , hadStoragePath , fullDeclaration , this ) ;
91+
92+ // construct bind target declaration
93+ const bindTargetDeclaration : BindTargetDeclaration = {
94+ storageType : storageType ,
95+ storagePath : storagePath ,
96+ storageProp : storageProp ,
97+ listenToChildren : unvalidatedBindTargetDeclaration . listenToChildren ,
98+ } ;
10399
104100 // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
105101 if ( source . id === BindTargetStorageType . SCOPE ) {
0 commit comments