summaryrefslogtreecommitdiffstats
path: root/source/core/slang-semantic-version.cpp
diff options
context:
space:
mode:
authorTheresa Foley <10618364+tangent-vector@users.noreply.github.com>2025-05-12 10:28:05 -0700
committerGitHub <noreply@github.com>2025-05-12 17:28:05 +0000
commit4c76b275907cf2d764f3fc51468d1c58635a10c1 (patch)
tree201a353c2b64b258760c370e641821ec5f6eff85 /source/core/slang-semantic-version.cpp
parent6b286bfbdf85e40cac1ee325384f535df969938a (diff)
Cleanups related to RIFF support (#7041)
Diffstat (limited to 'source/core/slang-semantic-version.cpp')
-rw-r--r--source/core/slang-semantic-version.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/core/slang-semantic-version.cpp b/source/core/slang-semantic-version.cpp
index b05eb503f..a7697ad8f 100644
--- a/source/core/slang-semantic-version.cpp
+++ b/source/core/slang-semantic-version.cpp
@@ -93,6 +93,28 @@ void SemanticVersion::append(StringBuilder& buf) const
return bestVersion;
}
+bool SemanticVersion::isBackwardsCompatibleWith(const ThisType& otherVersion) const
+{
+ // Compatibility is not guaranteed across major revisions.
+ //
+ if (m_major != otherVersion.m_major)
+ return false;
+
+ // Within a given major revision, a version with a higher
+ // minor revision is backwards-compatible with one that
+ // has a lower minor revision, but not vice-versa.
+ //
+ if (m_minor < otherVersion.m_minor)
+ return false;
+
+ // If the major and minor revisions pass our check, then
+ // we consider it a match. Note that this intentionally
+ // doesn't check the path version at all.
+ //
+ return true;
+}
+
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MatchSemanticVersion !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/* static */ SemanticVersion MatchSemanticVersion::findAnyBest(