summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgmeth.nim3
-rw-r--r--compiler/commands.nim2
-rw-r--r--compiler/options.nim1
3 files changed, 6 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)))
diff --git a/compiler/commands.nim b/compiler/commands.nim
index ee16702a2..2bccc4d81 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -758,6 +758,8 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     defineSymbol(conf.symbols, "cppCompileToNamespace", conf.cppCustomNamespace)
   of "docinternal":
     processOnOffSwitchG(conf, {optDocInternal}, arg, pass, info)
+  of "multimethods":
+    processOnOffSwitchG(conf, {optMultiMethods}, arg, pass, info)
   else:
     if strutils.find(switch, '.') >= 0: options.setConfigVar(conf, switch, arg)
     else: invalidCmdLineOption(conf, pass, switch, info)
diff --git a/compiler/options.nim b/compiler/options.nim
index d031da089..cf89e3488 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -83,6 +83,7 @@ type                          # please make sure we have under 32 options
     optHotCodeReloading
     optDynlibOverrideAll
     optNimV2
+    optMultiMethods
 
   TGlobalOptions* = set[TGlobalOption]