Skip to content

Commit

Permalink
helper function to emit get a namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
NotFound committed Jun 10, 2012
1 parent bb75b75 commit 1d33d94
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions winxedxx.winxed
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ function ncisigtoc(string sig)
}

//**********************************************************************
// Emit helpers
//**********************************************************************

function emit_namespacefromroot(var out, var path)
{
out.print("getRootNamespace()");
for (string item in path)
out.print(".childNamespace(\"", item, "\")");
}

function emit_plainfun1(var out, string name, var arg)
{
Expand Down Expand Up @@ -746,9 +755,7 @@ function emit_CallExpr(out, callexpr)
case funref instanceof FunctionRef:
var path = funref.sym.owner.getpath().path;
var name = funref.getstart();
out.print("getRootNamespace()");
for (string item in path)
out.print(".childNamespace(\"", item, "\")");
emit_namespacefromroot(out, path);
out.print(".get(\"", name.getidentifier(), "\")");
break;
case funref.isidentifier():
Expand Down Expand Up @@ -1257,10 +1264,8 @@ function emit_OpNamespaceExpr(out, expr)
if (sym == null)
WxxError("unknow namespace", expr);
var path = sym.getpath().path;
out.print("WxxObjectPtr(& (getRootNamespace()");
int l = elements(path);
for (int i = 0; i < l; ++i)
out.print(".childNamespace(\"", path[i], "\")");
out.print("WxxObjectPtr(& (");
emit_namespacefromroot(out, path);
out.print("))");
}

Expand Down

0 comments on commit 1d33d94

Please sign in to comment.