Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generic fields #45

Open
mratsim opened this issue Jul 16, 2022 · 0 comments
Open

Add support for generic fields #45

mratsim opened this issue Jul 16, 2022 · 0 comments

Comments

@mratsim
Copy link

mratsim commented Jul 16, 2022

This fails with "Unexpected bracket expression array[" as genny tries to call getTypeInst on a A[B].

internal.add &"proc $lib_{objNameSnaked}*("
let objType = sym.getType()
for fieldSym in objType[2]:
let
fieldName = fieldSym.repr
fieldType = fieldSym.getTypeInst()

import genny

type
  Foo = object
    val: array[3, uint64]

proc sum(r: var Foo, a, b: Foo) =
  for i in 0 ..< r.val.len:
    r.val[i] = a.val[i] + b.val[i]

exportObject Foo:
  procs:
    sum(Foo, Foo, Foo)

writeFiles("bindings/generated", "test")
include generated/internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant