Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEROM22 committed Dec 19, 2024
1 parent 8577b51 commit c28b4ec
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
42 changes: 30 additions & 12 deletions packages/typedoc-signature/lib/internal/concise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function enumReflection(ctx: Context, r: J.Reflection): Signature {
return s
}

export function functionsDeclaration(f: J.Reflection): Signature {
export function functionsDeclaration(ctx: Context, f: J.Reflection): Signature {
const s: Signature = []

if (!isCallSignatureReflection(f)) {
Expand All @@ -109,16 +109,20 @@ export function functionsDeclaration(f: J.Reflection): Signature {

let t: Token

t = new TextToken()
t.text = " "
s.push(t)

const b = parameters(f)
s.push(...b)

t = new TextToken()
t.text = ": "
s.push(t)
if (f.type) {
if ("name" in f.type && f.type.name === "void") {
return s
}
t = new TextToken()
t.text = ": "
s.push(t)

const b = type(ctx, f.type)
s.push(...b)
}

return s
}
Expand All @@ -139,20 +143,34 @@ export function interfaceReflection(ctx: Context, r: J.Reflection): Signature {
return s
}

export function methodDeclaration(m: J.Reflection): Signature {
export function methodDeclaration(ctx: Context, m: J.Reflection): Signature {
const s: Signature = []

if (!isSignatureReflection(m)) {
return s
}

let t: Token

const b = parameters(m)
s.push(...b)

const t = new TextToken()
t = new TextToken()
t.text = ": "
s.push(t)

if (m.type) {
if ("name" in m.type && m.type.name === "void") {
return s
}
t = new TextToken()
t.text = ": "
s.push(t)

const b = type(ctx, m.type)
s.push(...b)
}

return s
}

Expand Down Expand Up @@ -285,7 +303,7 @@ export function arrayType(ctx: Context, a: J.ArrayType): Signature {
const s: Signature = []
let t: Token

if (isUnionType(a.elementType.type)) {
if (isUnionType(a.elementType)) {
t = new TextToken()
t.text = "("
s.push(t)
Expand All @@ -294,7 +312,7 @@ export function arrayType(ctx: Context, a: J.ArrayType): Signature {
const b = type(ctx, a.elementType)
s.push(...b)

if (isUnionType(a.elementType.type)) {
if (isUnionType(a.elementType)) {
const t = new TextToken()
t.text = ")"
s.push(t)
Expand Down
8 changes: 4 additions & 4 deletions packages/typedoc-signature/lib/internal/verbose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function classDeclaration(ctx: Context, r: J.Reflection): Signature {
if (isMethodReflection(c) && c.signatures) {
for (const cs of c.signatures) {
if (isSignatureReflection(cs)) {
const md = methodDeclaration(cs, c, ctx)
const md = methodDeclaration(ctx, cs, c)
const ts: Signature = []
for (const e of md) {
if (e instanceof EntityToken) {
Expand Down Expand Up @@ -394,9 +394,9 @@ export function interfaceReflection(ctx: Context, r: J.Reflection): Signature {
}

export function methodDeclaration(
ctx: Context,
r: J.Reflection,
p: J.Reflection,
ctx: Context,
): Signature {
let s: Signature = []

Expand Down Expand Up @@ -717,7 +717,7 @@ export function arrayType(ctx: Context, a: J.ArrayType): Signature {
let s: Signature = []
let t: Token

if (isUnionType(a.elementType.type)) {
if (isUnionType(a.elementType)) {
t = new TextToken()
t.text = "("
s.push(t)
Expand All @@ -726,7 +726,7 @@ export function arrayType(ctx: Context, a: J.ArrayType): Signature {
const b = type(ctx, a.elementType)
s.push(...b)

if (isUnionType(a.elementType.type)) {
if (isUnionType(a.elementType)) {
t = ctx.s.nt()
s.push(t)

Expand Down
6 changes: 3 additions & 3 deletions packages/typedoc-signature/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ export function compute(ct: Transport): void {
c.push(...C.enumReflection(cf, t))
} else if (isFunctionReflection(p) && isCallSignatureReflection(t)) {
v.push(...V.functionsDeclaration(cf, t))
c.push(...C.functionsDeclaration(t))
c.push(...C.functionsDeclaration(cf, t))
r.push(...C.returns(cf, t.type))
} else if (isInterfaceReflection(t)) {
v.push(...V.interfaceReflection(cf, t))
c.push(...C.interfaceReflection(cf, t))
} else if (isMethodReflection(p) && isCallSignatureReflection(t)) {
v.push(...V.methodDeclaration(t, p, cf))
c.push(...C.methodDeclaration(t))
v.push(...V.methodDeclaration(cf, t, p))
c.push(...C.methodDeclaration(cf, t))
r.push(...C.returns(cf, t.type))
} else if (isPropertyReflection(t)) {
v.push(...V.propertyReflection(cf, t))
Expand Down

0 comments on commit c28b4ec

Please sign in to comment.