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" &