From 3f312fbebd4cb6fe31b3a18cf7151b0cbcfd48e7 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Tue, 18 Jun 2024 10:26:06 +0200 Subject: [PATCH] Make linter happy --- compiler/src/model/build-model.ts | 4 ++-- compiler/src/model/utils.ts | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/compiler/src/model/build-model.ts b/compiler/src/model/build-model.ts index 812d4ac8ca..303499c87a 100644 --- a/compiler/src/model/build-model.ts +++ b/compiler/src/model/build-model.ts @@ -444,7 +444,7 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int for (const typeParameter of declaration.getTypeParameters()) { type.generics = (type.generics ?? []).concat({ name: modelGenerics(typeParameter), - namespace: type.name.namespace + '.' + type.name.name + namespace: type.name.namespace + '.' + type.name.name }) } @@ -532,7 +532,7 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int for (const typeParameter of declaration.getTypeParameters()) { type.generics = (type.generics ?? []).concat({ name: modelGenerics(typeParameter), - namespace: type.name.namespace + '.' + type.name.name + namespace: type.name.namespace + '.' + type.name.name }) } diff --git a/compiler/src/model/utils.ts b/compiler/src/model/utils.ts index a11c2dafed..7397f86403 100644 --- a/compiler/src/model/utils.ts +++ b/compiler/src/model/utils.ts @@ -343,20 +343,20 @@ export function modelType (node: Node): model.ValueOf { namespace: getNameSpace(node) } } - + if (Node.isTypeParameterDeclaration(declaration)) { - const parent = declaration.getParent(); + const parent = declaration.getParent() assert( - parent, - Node.isClassDeclaration(parent) || - Node.isInterfaceDeclaration(parent) || - Node.isTypeAliasDeclaration(parent), - 'It should be a class, interface, enum, type alias, or type parameter declaration' + parent, + Node.isClassDeclaration(parent) || + Node.isInterfaceDeclaration(parent) || + Node.isTypeAliasDeclaration(parent), + 'It should be a class, interface, enum, type alias, or type parameter declaration' ) - - type.type.namespace += '.' + parent.getName() as string; + + type.type.namespace = `${type.type.namespace}.${parent.getName()}` } - + return type } } @@ -489,10 +489,9 @@ export function modelEnumDeclaration (declaration: EnumDeclaration): model.Enum export function modelTypeAlias (declaration: TypeAliasDeclaration): model.TypeAlias { const type = declaration.getTypeNode() assert(declaration, type != null, 'Type alias without a referenced type') - const generics = declaration.getTypeParameters().map(typeParameter => ({ name: modelGenerics(typeParameter), - namespace: getNameSpace(typeParameter) + '.' + declaration.getName() as string + namespace: getNameSpace(typeParameter) + '.' + declaration.getName() })) const alias = modelType(type)