Commit 92457a156cd8d842c21cd3844247a755af01d144
1 parent
18d805d8
don't wrap object fields as default
Showing
1 changed file
with
5 additions
and
4 deletions
src/squeaknim.nim
... | ... | @@ -164,7 +164,7 @@ macro exportSt*(body: stmt): stmt = |
164 | 164 | "\t^self externalCallFailed\C!\C\C") |
165 | 165 | stCode.add(st & "\C\t\"Generated by NimSqueak\"\C\t" & apicall) |
166 | 166 | |
167 | -macro wrapObject*(typ: stmt): stmt = | |
167 | +macro wrapObject*(typ: stmt; wrapFields=false): stmt = | |
168 | 168 | ## Declares a SmallTalk wrapper class. |
169 | 169 | var t = typ.getType() |
170 | 170 | if t.typeKind == ntyTypeDesc: |
... | ... | @@ -177,9 +177,10 @@ macro wrapObject*(typ: stmt): stmt = |
177 | 177 | t = t[1] |
178 | 178 | expectKind t, nnkRecList |
179 | 179 | var fields = "" |
180 | - for i in 0.. < t.len: | |
181 | - expectKind t[i], nnkSym | |
182 | - fields.addf "\t\t($# '$#')\C", $t[i], mapTypeToC(t[i]) | |
180 | + if $wrapFields == "true": | |
181 | + for i in 0.. < t.len: | |
182 | + expectKind t[i], nnkSym | |
183 | + fields.addf "\t\t($# '$#')\C", $t[i], mapTypeToC(t[i]) | |
183 | 184 | |
184 | 185 | let st = ("ExternalStructure subclass: #$1\C" & |
185 | 186 | "\tinstanceVariableNames: ''\C" & | ... | ... |