mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
`cbuilder` is now split into `cbuilderbase`, `cbuilderexprs`, `cbuilderdecls`, with all the struct builder code up to this point going in `cbuilderdecls`. Variable builders are added, with local, global and constant variables implemented, but not threadvars. A builder for struct (braced) initializers is added. The field names have to be passed to build each field (so they can be used in `oconstr` in nifc), but they're not used in the output code if a flag `orderCompliant` is enabled, which means the initializer list is generated in order of the built fields. The version which uses the names on C is not implemented (C99 designated initializers), so this flag has to be enabled for now. The struct builders now generate the struct as an inline expression if a name isn't provided rather than a statement. This means we can now use `addSimpleStruct` etc for the type of fields, but we can't replace `addFieldWithStructType` because of `#pragma pack(pop)`. Doc comments are added to every usable proc but may still not be sufficient.
7 lines
90 B
Nim
7 lines
90 B
Nim
type
|
|
Snippet = string
|
|
Builder = string
|
|
|
|
template newBuilder(s: string): Builder =
|
|
s
|