diff options
author | Araq <rumpf_a@web.de> | 2014-01-23 19:23:41 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-23 19:23:41 +0100 |
commit | f332ac1d375cc4e17003ae630a0c6ca28c3f06b7 (patch) | |
tree | 6ee323edbddbb99fde61e95d5633132fa99b8ddf /compiler | |
parent | 3e5cb6644f4df51c3f3131108fc7836c431b53c2 (diff) | |
download | Nim-f332ac1d375cc4e17003ae630a0c6ca28c3f06b7.tar.gz |
renderer knows about nkStaticTy and nkTypeClassTy
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/renderer.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 6588caa04..1afb5961e 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -426,6 +426,8 @@ proc lsub(n: PNode): int = of nkVarTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + len("var") of nkDistinctTy: result = (if n.len > 0: lsub(n.sons[0])+1 else: 0) + len("Distinct") + of nkStaticTy: result = (if n.len > 0: lsub(n.sons[0]) else: 0) + + len("static[]") of nkTypeDef: result = lsons(n) + 3 of nkOfInherit: result = lsub(n.sons[0]) + len("of_") of nkProcTy: result = lsons(n) + len("proc_") @@ -701,6 +703,19 @@ proc gproc(g: var TSrcGen, n: PNode) = gcoms(g) dedent(g) +proc gTypeClassTy(g: var TSrcGen, n: PNode) = + var c: TContext + initContext(c) + putWithSpace(g, tkGeneric, "generic") + gsons(g, n[0], c) # arglist + gsub(g, n[1]) # pragmas + gsub(g, n[2]) # of + gcoms(g) + indentNL(g) + gcoms(g) + gstmts(g, n[3], c) + dedent(g) + proc gblock(g: var TSrcGen, n: PNode) = var c: TContext initContext(c) @@ -1054,6 +1069,12 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = gsub(g, n.sons[0]) else: put(g, tkShared, "shared") + of nkStaticTy: + put(g, tkStatic, "static") + put(g, tkBracketLe, "[") + if n.len > 0: + gsub(g, n.sons[0]) + put(g, tkBracketRi, "]") of nkEnumTy: if sonsLen(n) > 0: putWithSpace(g, tkEnum, "enum") @@ -1256,6 +1277,8 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) = initContext c putWithSpace g, tkSymbol, if n.kind == nkState: "state" else: "goto" gsons(g, n, c) + of nkTypeClassTy: + gTypeClassTy(g, n) else: #nkNone, nkExplicitTypeListCall: internalError(n.info, "rnimsyn.gsub(" & $n.kind & ')') |