1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

semver: refactor, simplify, fix typo (#18272)

This commit is contained in:
Turiiya
2023-05-27 00:57:02 +02:00
committed by GitHub
parent 3e08487198
commit f9efbdff10
4 changed files with 64 additions and 102 deletions

View File

@ -43,10 +43,9 @@ pub fn from(input string) !Version {
return &EmptyInputError{}
}
raw_version := parse(input)
version := raw_version.validate() or { return &InvalidVersionFormatError{
return raw_version.validate() or { return &InvalidVersionFormatError{
input: input
} }
return version
}
// build returns a `Version` structure with given `major`, `minor` and `patch` versions.
@ -105,7 +104,7 @@ pub fn (ver Version) str() string {
return '${common_string}${prerelease_string}${metadata_string}'
}
// * Utilites.
// * Utilities.
// coerce converts the `input` version to a `Version` struct.
// coerce will strip any contents *after* the parsed version string:
/*