Fixes #5062 (#5527); JS: holes in enums

This commit is contained in:
Silvio 2017-03-15 10:33:37 +01:00 • committed by Andreas Rumpf
commit 51cd3bd86f
9 changed files with 95 additions and 27 deletions

View file

@ -104,10 +104,10 @@ proc genEnumInfo(p: PProc, typ: PType, name: Rope) =
let field = typ.n.sons[i].sym
if i > 0: add(s, ", " & tnl)
let extName = if field.ast == nil: field.name.s else: field.ast.strVal
addf(s, "{kind: 1, offset: $1, typ: $2, name: $3, len: 0, sons: null}",
addf(s, "\"$1\": {kind: 1, offset: $1, typ: $2, name: $3, len: 0, sons: null}",
[rope(field.position), name, makeJSString(extName)])
var n = ("var NNI$1 = {kind: 2, offset: 0, typ: null, " &
"name: null, len: $2, sons: [$3]};$n") % [rope(typ.id), rope(length), s]
"name: null, len: $2, sons: {$3}};$n") % [rope(typ.id), rope(length), s]
s = ("var $1 = {size: 0, kind: $2, base: null, node: null, " &
"finalizer: null};$n") % [name, rope(ord(typ.kind))]
prepend(p.g.typeInfo, s)