Automatic deref for everything but pointers in asm/emit (#8891)

Fixes #7249
This commit is contained in:
LemonBoy 2018-09-07 01:54:59 +02:00 • committed by Andreas Rumpf
commit af1e84f54d
5 changed files with 42 additions and 10 deletions

View file

@ -27,10 +27,10 @@ block:
var global = T(a: 11, b: "foo")
proc test(): bool =
var obj = T(a: 11, b: "foo")
{. emit: [result, " = (", obj.addr[], "[0].a == 11);"] .}
{. emit: [result, " = ", result, " && (", obj.addr[], "[0].b == \"foo\");"] .}
{. emit: [result, " = ", result, " && (", global, "[0].a == 11);"] .}
{. emit: [result, " = ", result, " && (", global, "[0].b == \"foo\");"] .}
{. emit: [result, " = (", obj.addr[], ".a == 11);"] .}
{. emit: [result, " = ", result, " && (", obj.addr[], ".b == \"foo\");"] .}
{. emit: [result, " = ", result, " && (", global, ".a == 11);"] .}
{. emit: [result, " = ", result, " && (", global, ".b == \"foo\");"] .}
echo test()
# Test addr of field: