Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid creating a dispatcher for single-candidate multis that are mark…
…ed as primitives
  • Loading branch information
sorear committed Jan 1, 2012
1 parent b5d9d05 commit 5dd6ed3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/Kernel.cs
Expand Up @@ -4746,19 +4746,24 @@ internal class MMDCandidate : MultiCandidate {
}

public static P6any MakeDispatcher(string name, P6any proto, P6any[] cands) {
//string s1 = "Dispatch";
//foreach (P6any s in cands)
// s1 += ", " + ((SubInfo)s.GetSlot("info")).name;
//Console.WriteLine("MakeDispatcher: {0}", s1);

if (proto != null && proto.mo.name == "Regex") goto ltm;
for (int i = 0; i < cands.Length; i++) {
if (cands[i] == null) continue;
if (cands[i].mo.name == "Regex") goto ltm;
break;
}

SubInfo si = (proto != null) ?
SubInfo si;
if (cands.Length == 1 && cands[0] != null && proto != null) {
si = proto.GetSlot("info") as SubInfo;
// minor hack...
if (si != null && si.extend != null &&
si.extend.ContainsKey("builtin")) {
return cands[0];
}
}

si = (proto != null) ?
new SubInfo((SubInfo)proto.GetSlot("info")) :
new SubInfo(name, StandardTypeProtoC);

Expand Down

0 comments on commit 5dd6ed3

Please sign in to comment.