Fix property injection prototype hoisting bug

This commit is contained in:
2022-09-13 22:34:16 -05:00
parent c966904418
commit a173393697
16 changed files with 64 additions and 31 deletions

View File

@@ -1,13 +1,13 @@
import {AbstractFactory} from './AbstractFactory'
import {
DEPENDENCY_KEYS_METADATA_KEY,
DEPENDENCY_KEYS_PROPERTY_METADATA_KEY,
DependencyRequirement,
Instantiable,
PropertyDependency,
} from '../types'
import {Collection, logIfDebugging} from '../../util'
import 'reflect-metadata'
import {getPropertyInjectionMetadata} from '../decorator/getPropertyInjectionMetadata'
/**
* Standard static-class factory. The token of this factory is a reference to a
@@ -57,7 +57,7 @@ export class Factory<T> extends AbstractFactory<T> {
let currentToken = this.token
do {
const loadedMeta = Reflect.getMetadata(DEPENDENCY_KEYS_PROPERTY_METADATA_KEY, currentToken)
const loadedMeta = getPropertyInjectionMetadata(currentToken)
logIfDebugging('extollo.di.injection', 'Factory.getInjectedProperties() target:', currentToken, 'loaded:', loadedMeta)
if ( loadedMeta ) {
meta.concat(loadedMeta)