Merge pull request #660 from genotrance/nimOldCaseObjects
Fix object variants - nim issue 1286
This commit is contained in:
commit
0e873c2702
3 changed files with 16 additions and 21 deletions
|
|
@ -1015,7 +1015,7 @@ proc test(options: Options) =
|
|||
let (_, name, ext) = file.path.splitFile()
|
||||
if ext == ".nim" and name[0] == 't' and file.kind in {pcFile, pcLinkToFile}:
|
||||
var optsCopy = options.briefClone()
|
||||
optsCopy.action.typ = actionCompile
|
||||
optsCopy.action = Action(typ: actionCompile)
|
||||
optsCopy.action.file = file.path
|
||||
optsCopy.action.backend = "c"
|
||||
optsCopy.action.compileOptions = @[]
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ proc getBinDir*(options: Options): string =
|
|||
options.getNimbleDir() / "bin"
|
||||
|
||||
proc parseCommand*(key: string, result: var Options) =
|
||||
result.action.typ = parseActionType(key)
|
||||
result.action = Action(typ: parseActionType(key))
|
||||
initAction(result, key)
|
||||
|
||||
proc parseArgument*(key: string, result: var Options) =
|
||||
|
|
@ -329,7 +329,7 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
|
|||
raise newException(NimbleError, "Unknown option: --" & flag)
|
||||
|
||||
proc initOptions*(): Options =
|
||||
result.action.typ = actionNil
|
||||
result.action = Action(typ: actionNil)
|
||||
result.pkgInfoCache = newTable[string, PackageInfo]()
|
||||
result.nimbleDir = ""
|
||||
result.verbosity = HighPriority
|
||||
|
|
|
|||
|
|
@ -130,34 +130,32 @@ proc contains*(ran: VersionRange, ver: Version): bool =
|
|||
return withinRange(ver, ran)
|
||||
|
||||
proc makeRange*(version: string, op: string): VersionRange =
|
||||
new(result)
|
||||
if version == "":
|
||||
raise newException(ParseVersionError,
|
||||
"A version needs to accompany the operator.")
|
||||
case op
|
||||
of ">":
|
||||
result.kind = verLater
|
||||
result = VersionRange(kind: verLater)
|
||||
of "<":
|
||||
result.kind = verEarlier
|
||||
result = VersionRange(kind: verEarlier)
|
||||
of ">=":
|
||||
result.kind = verEqLater
|
||||
result = VersionRange(kind: verEqLater)
|
||||
of "<=":
|
||||
result.kind = verEqEarlier
|
||||
result = VersionRange(kind: verEqEarlier)
|
||||
of "":
|
||||
result.kind = verEq
|
||||
result = VersionRange(kind: verEq)
|
||||
else:
|
||||
raise newException(ParseVersionError, "Invalid operator: " & op)
|
||||
result.ver = Version(version)
|
||||
|
||||
proc parseVersionRange*(s: string): VersionRange =
|
||||
# >= 1.5 & <= 1.8
|
||||
new(result)
|
||||
if s.len == 0:
|
||||
result.kind = verAny
|
||||
result = VersionRange(kind: verAny)
|
||||
return
|
||||
|
||||
if s[0] == '#':
|
||||
result.kind = verSpecial
|
||||
result = VersionRange(kind: verSpecial)
|
||||
result.spe = s.Version
|
||||
return
|
||||
|
||||
|
|
@ -169,7 +167,7 @@ proc parseVersionRange*(s: string): VersionRange =
|
|||
of '>', '<', '=':
|
||||
op.add(s[i])
|
||||
of '&':
|
||||
result.kind = verIntersect
|
||||
result = VersionRange(kind: verIntersect)
|
||||
result.verILeft = makeRange(version, op)
|
||||
|
||||
# Parse everything after &
|
||||
|
|
@ -204,10 +202,10 @@ proc toVersionRange*(ver: Version): VersionRange =
|
|||
## Converts a version to either a verEq or verSpecial VersionRange.
|
||||
new(result)
|
||||
if ver.isSpecial:
|
||||
result.kind = verSpecial
|
||||
result = VersionRange(kind: verSpecial)
|
||||
result.spe = ver
|
||||
else:
|
||||
result.kind = verEq
|
||||
result = VersionRange(kind: verEq)
|
||||
result.ver = ver
|
||||
|
||||
proc parseRequires*(req: string): PkgTuple =
|
||||
|
|
@ -263,17 +261,14 @@ proc getSimpleString*(verRange: VersionRange): string =
|
|||
result = ""
|
||||
|
||||
proc newVRAny*(): VersionRange =
|
||||
new(result)
|
||||
result.kind = verAny
|
||||
result = VersionRange(kind: verAny)
|
||||
|
||||
proc newVREarlier*(ver: string): VersionRange =
|
||||
new(result)
|
||||
result.kind = verEarlier
|
||||
result = VersionRange(kind: verEarlier)
|
||||
result.ver = newVersion(ver)
|
||||
|
||||
proc newVREq*(ver: string): VersionRange =
|
||||
new(result)
|
||||
result.kind = verEq
|
||||
result = VersionRange(kind: verEq)
|
||||
result.ver = newVersion(ver)
|
||||
|
||||
proc findLatest*(verRange: VersionRange,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue