Revert "feat(core): support metadata reflection for native class types (#22356)"
This reverts commit 5c89d6bffa
.
This commit is contained in:
@ -15,12 +15,9 @@ import {GetterFn, MethodFn, SetterFn} from './types';
|
||||
|
||||
|
||||
/**
|
||||
* Attention: These regex has to hold even if the code is minified!
|
||||
* Attention: This regex has to hold even if the code is minified!
|
||||
*/
|
||||
export const DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
|
||||
export const INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/;
|
||||
export const INHERITED_CLASS_WITH_CTOR =
|
||||
/^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/;
|
||||
|
||||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
private _reflect: any;
|
||||
@ -60,7 +57,6 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
}
|
||||
|
||||
private _ownParameters(type: Type<any>, parentCtor: any): any[][]|null {
|
||||
const typeStr = type.toString();
|
||||
// If we have no decorators, we only have function.length as metadata.
|
||||
// In that case, to detect whether a child class declared an own constructor or not,
|
||||
// we need to look inside of that constructor to check whether it is
|
||||
@ -68,8 +64,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
// This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
|
||||
// that sets 'design:paramtypes' to []
|
||||
// if a class inherits from another class but has no ctor declared itself.
|
||||
if (DELEGATE_CTOR.exec(typeStr) ||
|
||||
(INHERITED_CLASS.exec(typeStr) && !INHERITED_CLASS_WITH_CTOR.exec(typeStr))) {
|
||||
if (DELEGATE_CTOR.exec(type.toString())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user