Optimization for createClass with shortcut typeDef creation (#4849)

This commit is contained in:
Jaco
2022-05-25 15:07:42 +03:00
committed by GitHub
parent 8649c17dd7
commit a7d826f839
5 changed files with 28 additions and 16 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ export class TypeRegistry implements Registry {
}
/**
* @description Returns tru if the type is in a Compat format
* @description Returns true if the type is in a Compat format
*/
public isLookupType (value: string): boolean {
return /Lookup\d+$/.test(value);
@@ -321,8 +321,9 @@ function extractAliases (params: Record<string, SiTypeParameter[]>, isContract?:
function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): [Record<number, PortableType>, Record<string, string>, Record<number, string>, Record<string, SiTypeParameter[]>] {
const nameInfo: [number, string, SiTypeParameter[]][] = [];
const types: Record<number, PortableType> = {};
const porCount = portable.length;
for (let i = 0; i < portable.length; i++) {
for (let i = 0; i < porCount; i++) {
const type = portable[i];
const extracted = extractName(portable, portable[i]);
@@ -337,8 +338,9 @@ function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): [
const lookups: Record<string, string> = {};
const names: Record<number, string> = {};
const params: Record<string, SiTypeParameter[]> = {};
const dupCount = dedup.length;
for (let i = 0; i < dedup.length; i++) {
for (let i = 0; i < dupCount; i++) {
const [lookupIndex, name, p] = dedup[i];
names[lookupIndex] = name;