24 lines
663 B
TypeScript
24 lines
663 B
TypeScript
// import {
|
|
// TypeUtil,
|
|
// } from '../util/TypeUtil';
|
|
|
|
import { Class } from './Class';
|
|
import { Executable } from './Executable';
|
|
|
|
const CONSTRUCTOR_NAME = 'constructor';
|
|
|
|
export class Constructor extends Executable {
|
|
// private _rawConstructor: Function;
|
|
|
|
public constructor(declaringClazz: Class, parameterTypes?: any[]) {
|
|
super(declaringClazz, CONSTRUCTOR_NAME, parameterTypes);
|
|
// this._rawConstructor = TypeUtil.getPrototype(declaringClazz.getType())[CONSTRUCTOR_NAME];
|
|
}
|
|
|
|
public newInstance(...args: any[]): any {
|
|
const ctor = this.getDeclaringClass().getType();
|
|
|
|
return new (ctor.bind.apply(ctor, [null].concat(args)))();
|
|
}
|
|
}
|