Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: utils/pub/version.dart

Issue 11638010: Convert /** comments to /// in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/pub/version_solver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/version.dart
diff --git a/utils/pub/version.dart b/utils/pub/version.dart
index 50174cc40cb6f676821ea71c7f9778d1746b341e..567a7a7117434e6fbeca619036740dfab9e264fb 100644
--- a/utils/pub/version.dart
+++ b/utils/pub/version.dart
@@ -2,20 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/**
- * Handles version numbers, following the [Semantic Versioning][semver] spec.
- *
- * [semver]: http://semver.org/
- */
+/// Handles version numbers, following the [Semantic Versioning][semver] spec.
+///
+/// [semver]: http://semver.org/
library version;
import 'dart:math';
import 'utils.dart';
-/** A parsed semantic version number. */
+/// A parsed semantic version number.
class Version implements Comparable, VersionConstraint {
- /** No released version: i.e. "0.0.0". */
+ /// No released version: i.e. "0.0.0".
static Version get none => new Version(0, 0, 0);
static final _PARSE_REGEX = new RegExp(
@@ -25,22 +23,22 @@ class Version implements Comparable, VersionConstraint {
r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build.
r'$'); // Consume entire string.
- /** The major version number: "1" in "1.2.3". */
+ /// The major version number: "1" in "1.2.3".
final int major;
- /** The minor version number: "2" in "1.2.3". */
+ /// The minor version number: "2" in "1.2.3".
final int minor;
- /** The patch version number: "3" in "1.2.3". */
+ /// The patch version number: "3" in "1.2.3".
final int patch;
- /** The pre-release identifier: "foo" in "1.2.3-foo". May be `null`. */
+ /// The pre-release identifier: "foo" in "1.2.3-foo". May be `null`.
final String preRelease;
- /** The build identifier: "foo" in "1.2.3+foo". May be `null`. */
+ /// The build identifier: "foo" in "1.2.3+foo". May be `null`.
final String build;
- /** Creates a new [Version] object. */
+ /// Creates a new [Version] object.
Version(this.major, this.minor, this.patch, {String pre, this.build})
: preRelease = pre {
if (major < 0) throw new ArgumentError(
@@ -51,9 +49,7 @@ class Version implements Comparable, VersionConstraint {
'Patch version must be non-negative.');
}
- /**
- * Creates a new [Version] by parsing [text].
- */
+ /// Creates a new [Version] by parsing [text].
factory Version.parse(String text) {
final match = _PARSE_REGEX.firstMatch(text);
if (match == null) {
@@ -86,7 +82,7 @@ class Version implements Comparable, VersionConstraint {
bool get isEmpty => false;
- /** Tests if [other] matches this version exactly. */
+ /// Tests if [other] matches this version exactly.
bool allows(Version other) => this == other;
VersionConstraint intersect(VersionConstraint other) {
@@ -136,11 +132,9 @@ class Version implements Comparable, VersionConstraint {
return buffer.toString();
}
- /**
- * Compares the string part of two versions. This is used for the pre-release
- * and build version parts. This follows Rule 12. of the Semantic Versioning
- * spec.
- */
+ /// Compares the string part of two versions. This is used for the pre-release
+ /// and build version parts. This follows Rule 12. of the Semantic Versioning
+ /// spec.
int _compareStrings(String a, String b) {
var aParts = _splitParts(a);
var bParts = _splitParts(b);
@@ -175,10 +169,8 @@ class Version implements Comparable, VersionConstraint {
}
}
- /**
- * Splits a string of dot-delimited identifiers into their component parts.
- * Identifiers that are numeric are converted to numbers.
- */
+ /// Splits a string of dot-delimited identifiers into their component parts.
+ /// Identifiers that are numeric are converted to numbers.
List _splitParts(String text) {
return text.split('.').map((part) {
try {
@@ -191,33 +183,27 @@ class Version implements Comparable, VersionConstraint {
}
}
-/**
- * A [VersionConstraint] is a predicate that can determine whether a given
- * version is valid or not. For example, a ">= 2.0.0" constraint allows any
- * version that is "2.0.0" or greater. Version objects themselves implement
- * this to match a specific version.
- */
+/// A [VersionConstraint] is a predicate that can determine whether a given
+/// version is valid or not. For example, a ">= 2.0.0" constraint allows any
+/// version that is "2.0.0" or greater. Version objects themselves implement
+/// this to match a specific version.
abstract class VersionConstraint {
- /**
- * A [VersionConstraint] that allows no versions: i.e. the empty set.
- */
+ /// A [VersionConstraint] that allows no versions: i.e. the empty set.
factory VersionConstraint.empty() => const _EmptyVersion();
- /**
- * Parses a version constraint. This string is a space-separated series of
- * version parts. Each part can be one of:
- *
- * * A version string like `1.2.3`. In other words, anything that can be
- * parsed by [Version.parse()].
- * * A comparison operator (`<`, `>`, `<=`, or `>=`) followed by a version
- * string. There cannot be a space between the operator and the version.
- *
- * Examples:
- *
- * 1.2.3-alpha
- * <=5.1.4
- * >2.0.4 <=2.4.6
- */
+ /// Parses a version constraint. This string is a space-separated series of
+ /// version parts. Each part can be one of:
+ ///
+ /// * A version string like `1.2.3`. In other words, anything that can be
+ /// parsed by [Version.parse()].
+ /// * A comparison operator (`<`, `>`, `<=`, or `>=`) followed by a version
+ /// string. There cannot be a space between the operator and the version.
+ ///
+ /// Examples:
+ ///
+ /// 1.2.3-alpha
+ /// <=5.1.4
+ /// >2.0.4 <=2.4.6
factory VersionConstraint.parse(String text) {
if (text.trim() == '') {
throw new FormatException('Cannot parse an empty string.');
@@ -232,12 +218,10 @@ abstract class VersionConstraint {
return new VersionConstraint.intersection(constraints);
}
- /**
- * Creates a new version constraint that is the intersection of [constraints].
- * It will only allow versions that all of those constraints allow. If
- * constraints is empty, then it returns a VersionConstraint that allows all
- * versions.
- */
+ /// Creates a new version constraint that is the intersection of
+ /// [constraints]. It will only allow versions that all of those constraints
+ /// allow. If constraints is empty, then it returns a VersionConstraint that
+ /// allows all versions.
factory VersionConstraint.intersection(
Collection<VersionConstraint> constraints) {
var constraint = new VersionRange();
@@ -247,20 +231,14 @@ abstract class VersionConstraint {
return constraint;
}
- /**
- * Returns `true` if this constraint allows no versions.
- */
+ /// Returns `true` if this constraint allows no versions.
bool get isEmpty;
- /**
- * Returns `true` if this constraint allows [version].
- */
+ /// Returns `true` if this constraint allows [version].
bool allows(Version version);
- /**
- * Creates a new [VersionConstraint] that only allows [Version]s allowed by
- * both this and [other].
- */
+ /// Creates a new [VersionConstraint] that only allows [Version]s allowed by
+ /// both this and [other].
VersionConstraint intersect(VersionConstraint other);
static VersionConstraint _parseSingleConstraint(String text) {
@@ -290,12 +268,10 @@ abstract class VersionConstraint {
}
}
-/**
- * Constrains versions to a fall within a given range. If there is a minimum,
- * then this only allows versions that are at that minimum or greater. If there
- * is a maximum, then only versions less than that are allowed. In other words,
- * this allows `>= min, < max`.
- */
+/// Constrains versions to a fall within a given range. If there is a minimum,
+/// then this only allows versions that are at that minimum or greater. If there
+/// is a maximum, then only versions less than that are allowed. In other words,
+/// this allows `>= min, < max`.
class VersionRange implements VersionConstraint {
final Version min;
final Version max;
@@ -321,7 +297,7 @@ class VersionRange implements VersionConstraint {
bool get isEmpty => false;
- /** Tests if [other] matches falls within this version range. */
+ /// Tests if [other] matches falls within this version range.
bool allows(Version other) {
if (min != null && other < min) return false;
if (min != null && !includeMin && other == min) return false;
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/pub/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698