From 92457a156cd8d842c21cd3844247a755af01d144 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 10 Mar 2015 21:59:25 +0100 Subject: [PATCH] don't wrap object fields as default --- src/squeaknim.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/squeaknim.nim b/src/squeaknim.nim index 410e9e4..aa182a5 100644 --- a/src/squeaknim.nim +++ b/src/squeaknim.nim @@ -164,7 +164,7 @@ macro exportSt*(body: stmt): stmt = "\t^self externalCallFailed\C!\C\C") stCode.add(st & "\C\t\"Generated by NimSqueak\"\C\t" & apicall) -macro wrapObject*(typ: stmt): stmt = +macro wrapObject*(typ: stmt; wrapFields=false): stmt = ## Declares a SmallTalk wrapper class. var t = typ.getType() if t.typeKind == ntyTypeDesc: @@ -177,9 +177,10 @@ macro wrapObject*(typ: stmt): stmt = t = t[1] expectKind t, nnkRecList var fields = "" - for i in 0.. < t.len: - expectKind t[i], nnkSym - fields.addf "\t\t($# '$#')\C", $t[i], mapTypeToC(t[i]) + if $wrapFields == "true": + for i in 0.. < t.len: + expectKind t[i], nnkSym + fields.addf "\t\t($# '$#')\C", $t[i], mapTypeToC(t[i]) let st = ("ExternalStructure subclass: #$1\C" & "\tinstanceVariableNames: ''\C" & -- libgit2 0.22.2