summaryrefslogtreecommitdiff
path: root/6/gen.c
diff options
context:
space:
mode:
Diffstat (limited to '6/gen.c')
-rw-r--r--6/gen.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/6/gen.c b/6/gen.c
index 2f1a937..d45cb40 100644
--- a/6/gen.c
+++ b/6/gen.c
@@ -74,6 +74,30 @@ char *asmname(Node *dcl)
return strdup(buf);
}
+char *tydescid(char *buf, size_t bufsz, Type *ty)
+{
+ char *sep, *ns;
+
+ sep = "";
+ ns = "";
+ if (ty->type == Tyname) {
+ if (ty->name->name.ns) {
+ ns = ty->name->name.ns;
+ sep = "$";
+ }
+ if (ty->vis == Visexport || ty->isimport)
+ snprintf(buf, bufsz, "_tydesc$%s%s%s", ns, sep, ty->name->name.name);
+ else
+ snprintf(buf, bufsz, "_tydesc$%s%s%s$%d", ns, sep, ty->name->name.name, ty->tid);
+ } else {
+ if (file->file.globls->name) {
+ ns = file->file.globls->name;
+ sep = "$";
+ }
+ snprintf(buf, bufsz, "_tydesc%s%s$%d",sep, ns, ty->tid);
+ }
+ return buf;
+}
void gen(Node *file, char *out)
{