Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use nesting depth to break ties in my multi sub
  • Loading branch information
sorear committed May 12, 2011
1 parent fd940af commit cbfec0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/CLRBackend.cs
Expand Up @@ -2588,15 +2588,18 @@ class NamProcessor {
string pn = prefix + ":(!proto)";

for (StaticSub csr = sub; ; csr = csr.outer.Resolve<StaticSub>()) {
bool brk = false;
foreach (KeyValuePair<string,Lexical> kp in csr.lexicals) {
if (Utils.StartsWithInvariant(filter, kp.Key) &&
kp.Key != pn &&
!names.Contains(kp.Key)) {
names.Add(kp.Key);
brk = true;
cands.Add(CpsOp.MethodCall(null, Tokens.Variable_Fetch, new CpsOp[] { RawAccessLex("scopedlex", kp.Key, null) }));
}
}
if (csr.outer == null) break;
if (brk) cands.Add(CpsOp.Null(Tokens.P6any));
}

return CpsOp.MethodCall(null, Tokens.Kernel_NewROScalar,
Expand Down

0 comments on commit cbfec0f

Please sign in to comment.