mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-22 00:41:28 +00:00
@@ -1065,29 +1065,6 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||
of "expandarc":
|
||||
expectArg(conf, switch, arg, pass, info)
|
||||
conf.arcToExpand[arg] = "T"
|
||||
of "useversion":
|
||||
expectArg(conf, switch, arg, pass, info)
|
||||
case arg
|
||||
of "1.0":
|
||||
defineSymbol(conf.symbols, "NimMajor", "1")
|
||||
defineSymbol(conf.symbols, "NimMinor", "0")
|
||||
# old behaviors go here:
|
||||
defineSymbol(conf.symbols, "nimOldRelativePathBehavior")
|
||||
undefSymbol(conf.symbols, "nimDoesntTrackDefects")
|
||||
ast.eqTypeFlags.excl {tfGcSafe, tfNoSideEffect}
|
||||
conf.globalOptions.incl optNimV1Emulation
|
||||
of "1.2":
|
||||
defineSymbol(conf.symbols, "NimMajor", "1")
|
||||
defineSymbol(conf.symbols, "NimMinor", "2")
|
||||
conf.globalOptions.incl optNimV12Emulation
|
||||
of "1.6":
|
||||
defineSymbol(conf.symbols, "NimMajor", "1")
|
||||
defineSymbol(conf.symbols, "NimMinor", "6")
|
||||
conf.globalOptions.incl optNimV16Emulation
|
||||
else:
|
||||
localError(conf, info, "unknown Nim version; currently supported values are: `1.0`, `1.2`")
|
||||
# always be compatible with 1.x.100:
|
||||
defineSymbol(conf.symbols, "NimPatch", "100")
|
||||
of "benchmarkvm":
|
||||
processOnOffSwitchG(conf, {optBenchmarkVM}, arg, pass, info)
|
||||
of "profilevm":
|
||||
|
||||
@@ -102,9 +102,6 @@ type # please make sure we have under 32 options
|
||||
optBenchmarkVM # Enables cpuTime() in the VM
|
||||
optProduceAsm # produce assembler code
|
||||
optPanics # turn panics (sysFatal) into a process termination
|
||||
optNimV1Emulation # emulate Nim v1.0
|
||||
optNimV12Emulation # emulate Nim v1.2
|
||||
optNimV16Emulation # emulate Nim v1.6
|
||||
optSourcemap
|
||||
optProfileVM # enable VM profiler
|
||||
optEnableDeepCopy # ORC specific: enable 'deepcopy' for all types.
|
||||
|
||||
@@ -396,7 +396,7 @@ proc addRaiseEffect(a: PEffects, e, comesFrom: PNode) =
|
||||
if sameType(a.graph.excType(aa[i]), a.graph.excType(e)): return
|
||||
|
||||
if e.typ != nil:
|
||||
if optNimV1Emulation in a.config.globalOptions or not isDefectException(e.typ):
|
||||
if not isDefectException(e.typ):
|
||||
throws(a.exc, e, comesFrom)
|
||||
|
||||
proc addTag(a: PEffects, e, comesFrom: PNode) =
|
||||
|
||||
@@ -130,8 +130,8 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType =
|
||||
e.typ = result
|
||||
e.position = int(counter)
|
||||
let symNode = newSymNode(e)
|
||||
if optNimV1Emulation notin c.config.globalOptions and identToReplace != nil and
|
||||
c.config.cmd notin cmdDocLike: # A hack to produce documentation for enum fields.
|
||||
if identToReplace != nil and c.config.cmd notin cmdDocLike:
|
||||
# A hack to produce documentation for enum fields.
|
||||
identToReplace[] = symNode
|
||||
if e.position == 0: hasNull = true
|
||||
if result.sym != nil and sfExported in result.sym.flags:
|
||||
@@ -1398,8 +1398,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
||||
addParamOrResult(c, arg, kind)
|
||||
styleCheckDef(c, a[j].info, arg)
|
||||
onDef(a[j].info, arg)
|
||||
if {optNimV1Emulation, optNimV12Emulation} * c.config.globalOptions == {}:
|
||||
a[j] = newSymNode(arg)
|
||||
a[j] = newSymNode(arg)
|
||||
|
||||
var r: PType
|
||||
if n[0].kind != nkEmpty:
|
||||
@@ -1761,7 +1760,7 @@ proc semProcTypeWithScope(c: PContext, n: PNode,
|
||||
if n[1].kind != nkEmpty and n[1].len > 0:
|
||||
pragma(c, s, n[1], procTypePragmas)
|
||||
when useEffectSystem: setEffectsForProcType(c.graph, result, n[1])
|
||||
elif c.optionStack.len > 0 and optNimV1Emulation notin c.config.globalOptions:
|
||||
elif c.optionStack.len > 0:
|
||||
# we construct a fake 'nkProcDef' for the 'mergePragmas' inside 'implicitPragmas'...
|
||||
s.ast = newTree(nkProcDef, newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info),
|
||||
newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info), newNodeI(nkEmpty, n.info))
|
||||
|
||||
@@ -1295,7 +1295,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
of tyNil: result = isNone
|
||||
else: discard
|
||||
of tyOrdinal:
|
||||
if isOrdinalType(a, allowEnumWithHoles = optNimV1Emulation in c.c.config.globalOptions):
|
||||
if isOrdinalType(a):
|
||||
var x = if a.kind == tyOrdinal: a[0] else: a
|
||||
if f[0].kind == tyNone:
|
||||
result = isGeneric
|
||||
|
||||
@@ -169,7 +169,6 @@ Advanced options:
|
||||
enable experimental language feature
|
||||
--legacy:$2
|
||||
enable obsolete/legacy language feature
|
||||
--useVersion:1.0|1.2|1.6 emulate Nim version X of the Nim compiler, for testing
|
||||
--benchmarkVM:on|off turn benchmarking of VM code with cpuTime() on|off
|
||||
--profileVM:on|off turn compile time VM profiler on|off
|
||||
--sinkInference:on|off turn sink parameter inference on|off (default: off)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##[
|
||||
`since` is used to emulate older versions of nim stdlib with `--useVersion`,
|
||||
`since` is used to emulate older versions of nim stdlib,
|
||||
see `tuse_version.nim`.
|
||||
|
||||
If a symbol `foo` is added in version `(1,3,5)`, use `{.since: (1.3.5).}`, not
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
matrix: "--useVersion:1.0"
|
||||
matrix: "-d:NimMajor=1 -d:NimMinor=0 -d:NimPatch=100"
|
||||
"""
|
||||
|
||||
{.warning[UnusedImport]: off.}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
matrix: "--useVersion:1.6"
|
||||
matrix: "-d:NimMajor=1 -d:NimMinor=6 -d:NimPatch=100"
|
||||
"""
|
||||
|
||||
{.warning[UnusedImport]: off.}
|
||||
|
||||
Reference in New Issue
Block a user