Skip to content

Commit

Permalink
Fix anonymous key handling in yaml compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
extremeheat committed Jul 3, 2024
1 parent 8f92544 commit 39be9cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions generators/protodef.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ function toYAML(input, followImports = true, document = false) {
}
}
key = key.trim(); val = val ? val.trim() : ''
if (key == '_') key = '__' + i
if (key === '_') {
const nkey = '__' + i
lines[i] = lines[i].replace(key, nkey)
key = nkey
}
if (!key) continue
if (key.startsWith('!')) {
if (key.startsWith('!StartDocs')) startedDocumenting = true
Expand Down Expand Up @@ -256,7 +260,7 @@ function transform(json) {
if (key.startsWith('!')) continue

if (Array.isArray(val) && !key.startsWith('%')) { // pass thru protodef json
if (key === '_') ctxPush({ anon: true, type: val })
if (key.startsWith('__')) ctxPush({ anon: true, type: val })
else ctxPush({ name: key, type: val })
} else if (typeof val === 'object') {
if (key.startsWith('%')) {
Expand Down

0 comments on commit 39be9cf

Please sign in to comment.