compiler finally supports 'object {.pragma.}' syntax

This commit is contained in:
Araq 2012-04-16 23:40:08 +02:00
commit cb79bf9f16
4 changed files with 25 additions and 4 deletions

View file

@ -528,7 +528,7 @@ proc typeSectionLeftSidePass(c: PContext, n: PNode) =
s.typ = newTypeS(tyForward, c)
s.typ.sym = s # process pragmas:
if a.sons[0].kind == nkPragmaExpr:
pragma(c, s, a.sons[0].sons[1], typePragmas)
pragma(c, s, a.sons[0].sons[1], typePragmas)
# add it here, so that recursive types are possible:
addInterfaceDecl(c, s)
a.sons[0] = newSymNode(s)

View file

@ -476,6 +476,11 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType): PType =
addSon(result, base)
result.n = newNodeI(nkRecList, n.info)
semRecordNodeAux(c, n.sons[2], check, pos, result.n, result.sym)
if n.sons[0].kind != nkEmpty:
# dummy symbol for `pragma`:
var s = newSymS(skType, newIdentNode(getIdent("dummy"), n.info), c)
s.typ = result
pragma(c, s, n.sons[0], typePragmas)
proc addParamOrResult(c: PContext, param: PSym, kind: TSymKind) =
if kind == skMacro and param.typ.kind in {tyTypeDesc, tyExpr, tyStmt}: