summary refs log tree commit diff stats
path: root/compiler/cgmeth.nim
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2019-03-18 08:21:38 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-18 08:21:37 +0100
commitafeca3d9feb31326c87543a1cce401ecaab0b24a (patch)
tree0df5f54cf5bf84342085e7e12cbdb77af19db7b1 /compiler/cgmeth.nim
parent9e28d52c2ff02d0808f2305c0107691ec3136129 (diff)
downloadNim-afeca3d9feb31326c87543a1cce401ecaab0b24a.tar.gz
multi-methods need to be explicitly enabled (#10856)
* multi-methods need to be explicitly enabled

* update changelog, manual and tutorial
Diffstat (limited to 'compiler/cgmeth.nim')
-rw-r--r--compiler/cgmeth.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim
index 3c329ca05..c97b1b1aa 100644
--- a/compiler/cgmeth.nim
+++ b/compiler/cgmeth.nim
@@ -290,6 +290,9 @@ proc generateMethodDispatchers*(g: ModuleGraph): PNode =
     var relevantCols = initIntSet()
     for col in countup(1, sonsLen(g.methods[bucket].methods[0].typ) - 1):
       if relevantCol(g.methods[bucket].methods, col): incl(relevantCols, col)
+      if optMultiMethods notin g.config.globalOptions:
+        # if multi-methods are not enabled, we are interested only in the first field
+        break
     sortBucket(g.methods[bucket].methods, relevantCols)
     addSon(result,
            newSymNode(genDispatcher(g, g.methods[bucket].methods, relevantCols)))