summary refs log tree commit diff stats
path: root/tests/proc
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2024-09-27 12:12:39 +0300
committerGitHub <noreply@github.com>2024-09-27 11:12:39 +0200
commit2cdc0e913fc6d7b3486b907de502faa508820c42 (patch)
tree04e79e8d0f9c6237e45cfe9e2b18e2628d934480 /tests/proc
parentdc3ffb6a71f36e3cfd1fc001d128a86b46c88e7a (diff)
downloadNim-2cdc0e913fc6d7b3486b907de502faa508820c42.tar.gz
use cbuilder for tuple/object generation (#24145)
based on #24127

Needs some tweaks to replace the other `struct` type generations, e.g.
seqs, maybe by exposing `BaseTypeKind` as a parameter. C++ and
codegenDecl etc seem like they are going to need attention.

Also `Builder` should really be `distinct string` that one has to call
`extract` on, but for this to be optimal in the current codegen, we
would need something like:

```nim
template buildInto(s: var string, builderName: untyped, body) =
  template `builderName`: untyped = Builder(s)
  body

buildInto(result, builder):
  builder.add ...
```

but this could be a separate PR since it might not work with the
compiler. The possibly-not-optimal alternative is to do:

```nim
template build(builderName: untyped, body): string =
  var `builderName` = Builder("")
  body
  extract(`builderName`)

result = build(builder):
  builder.add ...
```

where the compiler maybe copies the built string but shouldn't.

---------

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Diffstat (limited to 'tests/proc')
0 files changed, 0 insertions, 0 deletions