Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Jun 18, 2024
1 parent 380fbd2 commit 3f312fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compiler/src/model/build-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down Expand Up @@ -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
})
}

Expand Down
23 changes: 11 additions & 12 deletions compiler/src/model/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3f312fb

Please sign in to comment.