summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/sem.nim1
-rwxr-xr-xcompiler/semdata.nim2
-rwxr-xr-xcompiler/sigmatch.nim12
3 files changed, 15 insertions, 0 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 7f461a11c..391bf840c 100755
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -166,6 +166,7 @@ proc myOpen(module: PSym, filename: string): PPassContext =
   c.semConstExpr = semConstExpr
   c.semExpr = semExprNoFlags
   c.semConstBoolExpr = semConstBoolExpr
+  c.semOverloadedCall = semOverloadedCall
   pushProcCon(c, module)
   pushOwner(c.module)
   openScope(c.tab)            # scope for imported symbols
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 202f752b5..0fc5399d2 100755
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -72,6 +72,8 @@ type
     semConstExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.} # for the pragmas
     semExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.}      # for the pragmas
     semConstBoolExpr*: proc (c: PContext, n: PNode): PNode {.nimcall.} # XXX bite the bullet
+    semOverloadedCall*: proc (c: PContext, n, nOrig: PNode,
+                              filter: TSymKinds): PNode {.nimcall.}
     includedFiles*: TIntSet    # used to detect recursive include files
     filename*: string          # the module's filename
     userPragmas*: TStrTable
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 39a754a80..f55d90a57 100755
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -603,6 +603,18 @@ proc userConvMatch(c: PContext, m: var TCandidate, f, a: PType,
       inc(m.convMatches)
       return
 
+proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, 
+                    arg: PNode): PNode = 
+  var call = newNodeI(nkCall, arg.info)
+  call.add(f.n.copyTree)
+  call.add(arg.copyTree)
+  result = c.semOverloadedCall(c, call, call, RoutineKinds)
+  if result != nil:
+    # resulting type must be consistent with the other arguments:
+    var r = typeRel(m, f, result.typ)
+    if r < isGeneric: return nil
+    if result.kind == nkCall: result.kind = nkHiddenCallConv
+    inc(m.convMatches)
 
 proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType, 
                         arg, argOrig: PNode): PNode =