Skip to content

Commit

Permalink
Improved formatting/display of documentation.
Browse files Browse the repository at this point in the history
Made the primary constructors private to prevent them from appearing in ScalaDoc.
  • Loading branch information
soc committed Apr 13, 2012
1 parent 020043c commit beae773
Show file tree
Hide file tree
Showing 10 changed files with 705 additions and 705 deletions.
48 changes: 24 additions & 24 deletions src/compiler/scala/tools/cmd/gen/AnyVals.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ trait AnyValReps {
def unaryOps = {
val ops = List(
Op("+", "/**\n" +
" * @return this value, unmodified\n" +
" * Returns this value, unmodified.\n" +
" */"),
Op("-", "/**\n" +
" * @return the negation of this value\n" +
" * Returns the negation of this value.\n" +
" */"))

if(isCardinal)
Op("~", "/**\n" +
" * @return the bitwise negation of this value\n" +
" * Returns the bitwise negation of this value.\n" +
" * @example {{{\n" +
" * ~5 == -6\n" +
" * // in binary: ~00000101 ==\n" +
Expand All @@ -41,7 +41,7 @@ trait AnyValReps {
if (isCardinal)
List(
Op("|", "/**\n" +
" * @return the bitwise OR of this value and x\n" +
" * Returns the bitwise OR of this value and `x`.\n" +
" * @example {{{\n" +
" * (0xf0 | 0xaa) == 0xfa\n" +
" * // in binary: 11110000\n" +
Expand All @@ -51,7 +51,7 @@ trait AnyValReps {
" * }}}\n" +
" */"),
Op("&", "/**\n" +
" * @return the bitwise AND of this value and x\n" +
" * Returns the bitwise AND of this value and `x`.\n" +
" * @example {{{\n" +
" * (0xf0 & 0xaa) == 0xa0\n" +
" * // in binary: 11110000\n" +
Expand All @@ -61,7 +61,7 @@ trait AnyValReps {
" * }}}\n" +
" */"),
Op("^", "/**\n" +
" * @return the bitwise XOR of this value and x\n" +
" * Returns the bitwise XOR of this value and `x`.\n" +
" * @example {{{\n" +
" * (0xf0 ^ 0xaa) == 0x5a\n" +
" * // in binary: 11110000\n" +
Expand All @@ -76,13 +76,13 @@ trait AnyValReps {
if (isCardinal)
List(
Op("<<", "/**\n" +
" * @return this value bit-shifted left by the specified number of bits,\n" +
" * Returns this value bit-shifted left by the specified number of bits,\n" +
" * filling in the new right bits with zeroes.\n" +
" * @example {{{ 6 << 3 == 48 // in binary: 0110 << 3 == 0110000 }}}\n" +
" */"),

Op(">>>", "/**\n" +
" * @return this value bit-shifted right by the specified number of bits,\n" +
" * Returns this value bit-shifted right by the specified number of bits,\n" +
" * filling the new left bits with zeroes.\n" +
" * @example {{{ 21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 }}}\n" +
" * @example {{{\n" +
Expand All @@ -93,7 +93,7 @@ trait AnyValReps {
" */"),

Op(">>", "/**\n" +
" * @return this value bit-shifted left by the specified number of bits,\n" +
" * Returns this value bit-shifted left by the specified number of bits,\n" +
" * filling in the right bits with the same value as the left-most bit of this.\n" +
" * The effect of this is to retain the sign of the value.\n" +
" * @example {{{\n" +
Expand All @@ -105,19 +105,19 @@ trait AnyValReps {
else Nil

def comparisonOps = List(
Op("==", "/**\n * @return `true` if this value is equal x, `false` otherwise\n */"),
Op("!=", "/**\n * @return `true` if this value is not equal to x, `false` otherwise\n */"),
Op("<", "/**\n * @return `true` if this value is less than x, `false` otherwise\n */"),
Op("<=", "/**\n * @return `true` if this value is less than or equal to x, `false` otherwise\n */"),
Op(">", "/**\n * @return `true` if this value is greater than x, `false` otherwise\n */"),
Op(">=", "/**\n * @return `true` if this value is greater than or equal to x, `false` otherwise\n */"))
Op("==", "/**\n * Returns `true` if this value is equal to x, `false` otherwise.\n */"),
Op("!=", "/**\n * Returns `true` if this value is not equal to x, `false` otherwise.\n */"),
Op("<", "/**\n * Returns `true` if this value is less than x, `false` otherwise.\n */"),
Op("<=", "/**\n * Returns `true` if this value is less than or equal to x, `false` otherwise.\n */"),
Op(">", "/**\n * Returns `true` if this value is greater than x, `false` otherwise.\n */"),
Op(">=", "/**\n * Returns `true` if this value is greater than or equal to x, `false` otherwise.\n */"))

def otherOps = List(
Op("+", "/**\n * @return the sum of this value and x\n */"),
Op("-", "/**\n * @return the difference of this value and x\n */"),
Op("*", "/**\n * @return the product of this value and x\n */"),
Op("/", "/**\n * @return the quotient of this value and x\n */"),
Op("%", "/**\n * @return the remainder of the division of this value by x\n */"))
Op("+", "/**\n * Returns the sum of this value and `x`.\n */"),
Op("-", "/**\n * Returns the difference of this value and `x`.\n */"),
Op("*", "/**\n * Returns the product of this value and `x`.\n */"),
Op("/", "/**\n * Returns the quotient of this value and `x`.\n */"),
Op("%", "/**\n * Returns the remainder of the division of this value by `x`.\n */"))

// Given two numeric value types S and T , the operation type of S and T is defined as follows:
// If both S and T are subrange types then the operation type of S and T is Int.
Expand Down Expand Up @@ -224,8 +224,8 @@ trait AnyValReps {
def classDoc = interpolate(classDocTemplate)
def objectDoc = ""
def mkImports = ""
def mkClass = assemble("final class", "AnyVal", classLines) + "\n"
def mkObject = assemble("object", "AnyValCompanion", objectLines) + "\n"
def mkClass = assemble("final class", "private", "AnyVal", classLines) + "\n"
def mkObject = assemble("object", "", "AnyValCompanion", objectLines) + "\n"
def make() = List[String](
headerTemplate,
mkImports,
Expand All @@ -235,8 +235,8 @@ trait AnyValReps {
mkObject
) mkString ""

def assemble(what: String, parent: String, lines: List[String]): String = {
val decl = "%s %s extends %s ".format(what, name, parent)
def assemble(what: String, ctor: String, parent: String, lines: List[String]): String = {
val decl = "%s %s %s extends %s ".format(what, name, ctor, parent)
val body = if (lines.isEmpty) "{ }\n\n" else lines map indent mkString ("{\n", "\n", "\n}\n")

decl + body
Expand Down
4 changes: 2 additions & 2 deletions src/library/scala/Boolean.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package scala
* There is an implicit conversion from [[scala.Boolean]] => [[scala.runtime.RichBoolean]]
* which provides useful non-primitive operations.
*/
final class Boolean extends AnyVal {
final class Boolean private extends AnyVal {
/**
* Negates a Boolean expression.
*
Expand Down Expand Up @@ -110,7 +110,7 @@ final class Boolean extends AnyVal {
override def getClass(): Class[Boolean] = sys.error("stub")
}

object Boolean extends AnyValCompanion {
object Boolean extends AnyValCompanion {

/** Transform a value type into a boxed reference type.
*
Expand Down
Loading

0 comments on commit beae773

Please sign in to comment.