diff --git a/server/src/jit/utils.ts b/server/src/jit/utils.ts index 5b1433f..dbbaa20 100644 --- a/server/src/jit/utils.ts +++ b/server/src/jit/utils.ts @@ -35,10 +35,10 @@ export function typeStringToStaticType(typeString: string, gvnt?: GlobalVariable } else if (typeString === 'Function') { return 'any' } else { - const clazz = gvnt === undefined ? undefined : gvnt.classTable().findClass(typeString) - if (clazz === undefined) + const type = gvnt === undefined ? undefined : gvnt.lookup(typeString)?.type + if (type === undefined || !(type instanceof InstanceType)) throw new ProfileError(`Cannot find the profiled class: ${typeString}`) - return clazz + return type } } diff --git a/server/src/transpiler/classes.ts b/server/src/transpiler/classes.ts index 7615134..ab5b7e5 100644 --- a/server/src/transpiler/classes.ts +++ b/server/src/transpiler/classes.ts @@ -265,15 +265,4 @@ export class ClassTable { return { offset: offset, unboxed: unboxed, props: props, unboxedTypes: unboxedTypes.join('')} } - - findClass(name: string, classes: InstanceType[] = this.rootClasses): InstanceType|undefined { - for (const clazz of classes) { - if (clazz.name() === name) - return clazz - const resultClass = this.findClass(name, clazz.subclasses()) - if (resultClass !== undefined) - return resultClass - } - return undefined - } }