diff options
author | Araq <rumpf_a@web.de> | 2013-07-24 23:07:28 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-07-24 23:07:28 +0200 |
commit | 9acdf94cc04726cb80e3012849d8f56f06615017 (patch) | |
tree | 1f0d2ecabc58bcb0a240000b24d282e4fa5afeb2 /tests/manyloc/named_argument_bug/gui.nim | |
parent | b1d4dfa6b1dc1b4f28f4634e95346d893f328465 (diff) | |
download | Nim-9acdf94cc04726cb80e3012849d8f56f06615017.tar.gz |
fixes #531
Diffstat (limited to 'tests/manyloc/named_argument_bug/gui.nim')
-rw-r--r-- | tests/manyloc/named_argument_bug/gui.nim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/manyloc/named_argument_bug/gui.nim b/tests/manyloc/named_argument_bug/gui.nim new file mode 100644 index 000000000..1e0bc6ffd --- /dev/null +++ b/tests/manyloc/named_argument_bug/gui.nim @@ -0,0 +1,44 @@ +import + tri_engine/gfx/gl/primitive, + tri_engine/gfx/tex, + tri_engine/gfx/color, + tri_engine/math/rect, + tri_engine/math/vec + +type + TWidgetLayer* = enum + wlBg = 100, + wlOverlap = 200, + wlMain = 300, + wlOverlay = 400, + wlCursor = 500 + TWidgetLayerType = TWidgetLayer|int + TWidgetType* = enum + wtImg + PWidget* = ref object + `type`* : TWidgetType + layer* : TWidgetLayer + rect* : TRect + prim* : PPrimitive + +const + baseZ = 5000 + +proc newWidget*(`type`: TWidgetType, layer: TWidgetLayerType, rect: TRect): PWidget = + new(result) + result.`type` = `type` + result.layer = layer + result.rect = rect + + var verts = newVert(rect) + + # This works because z is accessible at this scope. + #var z = baseZ + layer.int + #result.prim = newPrimitive(verts, z=z) + + # Doesn't work, because the compiler looks for a symbol called z in this scope, + # but it should only check that it is the name of one of the params. + #result.prim = newPrimitive(verts, z=baseZ + layer.int) + + # This doesn't work either. + result.prim = newPrimitive(verts, z=0) |