Skip to content

Commit

Permalink
Show "void" for 0-arg signatures in compact form
Browse files Browse the repository at this point in the history
  • Loading branch information
mebeim committed Mar 20, 2024
1 parent 4811fcb commit bc0fddf
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,25 +362,32 @@ function fillRow(row, tag, sc, maxArgs) {
const sig = document.createElement('td')
row.appendChild(sig)

for (let i = 0; i < sc.signature.length; i++) {
const arg = sc.signature[i]
const spaceIdx = arg.trimEnd().lastIndexOf(' ')

if (spaceIdx === -1) {
sig.append(document.createTextNode(arg))
} else {
const type = document.createElement('span')
const name = document.createElement('span')
type.classList.add('argtype')
name.classList.add('argname')
type.textContent = arg.slice(0, spaceIdx)
name.textContent = arg.slice(spaceIdx)
sig.appendChild(type)
sig.appendChild(name)
if (sc.signature.length > 0) {
for (let i = 0; i < sc.signature.length; i++) {
const arg = sc.signature[i]
const spaceIdx = arg.trimEnd().lastIndexOf(' ')

if (spaceIdx === -1) {
sig.append(document.createTextNode(arg))
} else {
const type = document.createElement('span')
const name = document.createElement('span')
type.classList.add('argtype')
name.classList.add('argname')
type.textContent = arg.slice(0, spaceIdx)
name.textContent = arg.slice(spaceIdx)
sig.appendChild(type)
sig.appendChild(name)
}

if (i < sc.signature.length - 1)
sig.append(document.createTextNode(', '))
}

if (i < sc.signature.length - 1)
sig.append(document.createTextNode(', '))
} else {
const type = document.createElement('span')
type.classList.add('argtype')
type.textContent = 'void'
sig.appendChild(type)
}
} else {
// Expanded signature: one column per argument
Expand Down

0 comments on commit bc0fddf

Please sign in to comment.