mirror of
https://github.com/apple/pkl.git
synced 2026-03-22 09:09:15 +01:00
make reflected values renderable (#170)
This commit is contained in:
11
pkl-core/src/test/files/LanguageSnippetTests/input/api/reflectedDeclaration.pkl
vendored
Normal file
11
pkl-core/src/test/files/LanguageSnippetTests/input/api/reflectedDeclaration.pkl
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import "pkl:reflect"
|
||||
|
||||
typealias MyAlias = Boolean | String
|
||||
|
||||
class Rec {
|
||||
rec: Rec?
|
||||
}
|
||||
|
||||
alias = reflect.TypeAlias(MyAlias)
|
||||
|
||||
rec = reflect.DeclaredType(reflect.Class(Rec))
|
||||
862
pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf
vendored
Normal file
862
pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf
vendored
Normal file
@@ -0,0 +1,862 @@
|
||||
alias {
|
||||
docComment = null
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "MyAlias"
|
||||
typeParameters = List()
|
||||
referent {
|
||||
members = List(new {
|
||||
referent {
|
||||
docComment = """
|
||||
A boolean value, either [true] or [false].
|
||||
|
||||
The following operators are supported for booleans:
|
||||
```
|
||||
!bool // logical negation
|
||||
bool1 && bool2 // logical conjunction
|
||||
bool1 || bool2 // logical disjunction
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set("external")
|
||||
name = "Boolean"
|
||||
typeParameters = List()
|
||||
properties = Map()
|
||||
methods = Map("xor", new {
|
||||
docComment = """
|
||||
Tells if exactly one of [this] and [other] is [true] (exclusive or).
|
||||
|
||||
Facts:
|
||||
```
|
||||
!true.xor(true)
|
||||
true.xor(false)
|
||||
false.xor(true)
|
||||
!false.xor(false)
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "xor"
|
||||
typeParameters = List()
|
||||
parameters = Map("other", new {
|
||||
name = "other"
|
||||
})
|
||||
}, "implies", new {
|
||||
docComment = """
|
||||
Tells if [this] implies [other] (logical consequence).
|
||||
|
||||
*Note*: This function does not short-circuit; [other] is always evaluated.
|
||||
|
||||
Facts:
|
||||
```
|
||||
true.implies(true)
|
||||
!true.implies(false)
|
||||
false.implies(true)
|
||||
false.implies(false)
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "implies"
|
||||
typeParameters = List()
|
||||
parameters = Map("other", new {
|
||||
name = "other"
|
||||
})
|
||||
})
|
||||
}
|
||||
typeArguments = List()
|
||||
}, new {
|
||||
referent {
|
||||
docComment = """
|
||||
A sequence of Unicode characters (code points).
|
||||
|
||||
The following operators are supported for strings:
|
||||
```
|
||||
str[3] // subscript
|
||||
str1 + str2 // concatenation
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set("external")
|
||||
name = "String"
|
||||
typeParameters = List()
|
||||
properties = Map("length", new {
|
||||
docComment = """
|
||||
The number of characters in this string.
|
||||
|
||||
*Note*: The runtime complexity of this operation is `O(n)`.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"".length == 0
|
||||
"abc".length == 3
|
||||
```
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"size"
|
||||
"count"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "length"
|
||||
}, "lastIndex", new {
|
||||
docComment = """
|
||||
The index of the last character in this string (same as `length - 1`).
|
||||
|
||||
Returns `-1` for an empty string.
|
||||
|
||||
*Note*: The runtime complexity of this operation is `O(n)`.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"".lastIndex == -1
|
||||
"abc".lastIndex == 2
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "lastIndex"
|
||||
}, "isEmpty", new {
|
||||
docComment = """
|
||||
Tells whether this string is empty.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"".isEmpty
|
||||
!(" ".isEmpty)
|
||||
!("abc".isEmpty)
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "isEmpty"
|
||||
}, "isBlank", new {
|
||||
docComment = """
|
||||
Tells if all characters in this string have Unicode property "White_Space".
|
||||
|
||||
Facts:
|
||||
```
|
||||
"".isBlank
|
||||
" ".isBlank
|
||||
"\\t\\n\\r".isBlank
|
||||
!("abc".isBlank)
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "isBlank"
|
||||
}, "isRegex", new {
|
||||
docComment = "Tells if this string is a valid regular expression according to [Regex]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "isRegex"
|
||||
}, "md5", new {
|
||||
docComment = """
|
||||
The [MD5](https://en.wikipedia.org/wiki/MD5)
|
||||
hash of this string's UTF-8 byte sequence
|
||||
as hexadecimal string.
|
||||
|
||||
MD5 is cryptographically broken and should not be used for secure applications.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "md5"
|
||||
}, "sha1", new {
|
||||
docComment = """
|
||||
The [SHA-1](https://en.wikipedia.org/wiki/SHA-1)
|
||||
hash of this string's UTF-8 byte sequence.
|
||||
|
||||
SHA-1 is cryptographically broken and should not be used for secure applications.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "sha1"
|
||||
}, "sha256", new {
|
||||
docComment = """
|
||||
The [SHA-256](https://en.wikipedia.org/wiki/SHA-2)
|
||||
cryptographic hash of this string's UTF-8 byte sequence
|
||||
as hexadecimal string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "sha256"
|
||||
}, "sha256Int", new {
|
||||
docComment = """
|
||||
The first 64 bits of the [SHA-256](https://en.wikipedia.org/wiki/SHA-2)
|
||||
cryptographic hash of this string's UTF-8 byte sequence.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "sha256Int"
|
||||
}, "base64", new {
|
||||
docComment = "The Base64 encoding of this string's UTF-8 byte sequence."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "base64"
|
||||
}, "base64Decoded", new {
|
||||
docComment = """
|
||||
The inverse of [base64].
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abc".base64.base64Decoded == "abc"
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "base64Decoded"
|
||||
}, "chars", new {
|
||||
docComment = """
|
||||
The Unicode characters in this string.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abc".chars == List("a", "b", "c")
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "chars"
|
||||
}, "codePoints", new {
|
||||
docComment = """
|
||||
The Unicode code points in this string.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abc".codePoints == List(0x61, 0x62, 0x63)
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "codePoints"
|
||||
})
|
||||
methods = Map("getOrNull", new {
|
||||
docComment = """
|
||||
Returns the character at [index], or [null] if [index] is out of range.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abcde".getOrNull(-1) == null
|
||||
"abcde".getOrNull(0) == "a"
|
||||
"abcde".getOrNull(2) == "c"
|
||||
"abcde".getOrNull(4) == "e"
|
||||
"abcde".getOrNull(5) == null
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "getOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map("index", new {
|
||||
name = "index"
|
||||
})
|
||||
}, "substring", new {
|
||||
docComment = """
|
||||
Returns the substring from [start] until [exclusiveEnd].
|
||||
|
||||
Throws if [start] is outside range `0`..[length] or [exclusiveEnd] is outside range [start]..[length].
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abcde".substring(0, 0) == ""
|
||||
"abcde".substring(0, 1) == "a"
|
||||
"abcde".substring(1, 4) == "bcd"
|
||||
"abcde".substring(4, 5) == "e"
|
||||
"abcde".substring(5, 5) == ""
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "substring"
|
||||
typeParameters = List()
|
||||
parameters = Map("start", new {
|
||||
name = "start"
|
||||
}, "exclusiveEnd", new {
|
||||
name = "exclusiveEnd"
|
||||
})
|
||||
}, "substringOrNull", new {
|
||||
docComment = """
|
||||
Returns the substring from [start] until [exclusiveEnd].
|
||||
|
||||
Returns [null] if [start] is outside range `0`..[length] or [exclusiveEnd] is outside range [start]..[length].
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abcde".substringOrNull(0, 0) == ""
|
||||
"abcde".substringOrNull(0, 1) == "a"
|
||||
"abcde".substringOrNull(1, 4) == "bcd"
|
||||
"abcde".substringOrNull(4, 5) == "e"
|
||||
"abcde".substringOrNull(5, 5) == ""
|
||||
|
||||
"abcde".substringOrNull(-1, 3) == null
|
||||
"abcde".substringOrNull(0, 6) == null
|
||||
"abcde".substringOrNull(3, 2) == null
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "substringOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map("start", new {
|
||||
name = "start"
|
||||
}, "exclusiveEnd", new {
|
||||
name = "exclusiveEnd"
|
||||
})
|
||||
}, "repeat", new {
|
||||
docComment = """
|
||||
Concatenates [count] copies of this string.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"abc".repeat(0) == ""
|
||||
"abc".repeat(1) == "abc"
|
||||
"abc".repeat(3) == "abcabcabc"
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "repeat"
|
||||
typeParameters = List()
|
||||
parameters = Map("count", new {
|
||||
name = "count"
|
||||
})
|
||||
}, "contains", new {
|
||||
docComment = "Tells whether this string contains [pattern]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "contains"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "matches", new {
|
||||
docComment = "Tells whether this string matches [regex] in its entirety."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"test"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "matches"
|
||||
typeParameters = List()
|
||||
parameters = Map("regex", new {
|
||||
name = "regex"
|
||||
})
|
||||
}, "startsWith", new {
|
||||
docComment = "Tells whether this string starts with [pattern]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "startsWith"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "endsWith", new {
|
||||
docComment = "Tells whether this string ends with [pattern]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "endsWith"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "indexOf", new {
|
||||
docComment = """
|
||||
Returns the zero-based index of the first occurrence of [pattern]
|
||||
in this string.
|
||||
|
||||
Throws if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "indexOf"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "indexOfOrNull", new {
|
||||
docComment = """
|
||||
Returns the zero-based index of the first occurrence of [pattern]
|
||||
in this string, or [null] if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "indexOfOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "lastIndexOf", new {
|
||||
docComment = """
|
||||
Returns the zero-based index of the last occurrence of [pattern]
|
||||
in this string.
|
||||
|
||||
Throws if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "lastIndexOf"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "lastIndexOfOrNull", new {
|
||||
docComment = """
|
||||
Returns the zero-based index of the last occurrence of [pattern]
|
||||
in this string, or [null] if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "lastIndexOfOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "take", new {
|
||||
docComment = """
|
||||
Returns the first [n] characters of this string.
|
||||
|
||||
Returns [this] if [n] is greater than or equal to [length].
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"limit"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "take"
|
||||
typeParameters = List()
|
||||
parameters = Map("n", new {
|
||||
name = "n"
|
||||
})
|
||||
}, "takeWhile", new {
|
||||
docComment = "Returns the longest prefix of this string that satisfies [predicate]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "takeWhile"
|
||||
typeParameters = List()
|
||||
parameters = Map("predicate", new {
|
||||
name = "predicate"
|
||||
})
|
||||
}, "takeLast", new {
|
||||
docComment = """
|
||||
Returns the last [n] characters of this string.
|
||||
|
||||
Returns [this] if [n] is greater than or equal to [length].
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "takeLast"
|
||||
typeParameters = List()
|
||||
parameters = Map("n", new {
|
||||
name = "n"
|
||||
})
|
||||
}, "takeLastWhile", new {
|
||||
docComment = "Returns the longest suffix of this string that satisfies [predicate]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "takeLastWhile"
|
||||
typeParameters = List()
|
||||
parameters = Map("predicate", new {
|
||||
name = "predicate"
|
||||
})
|
||||
}, "drop", new {
|
||||
docComment = """
|
||||
Removes the first [n] characters of this string.
|
||||
|
||||
Returns the empty string if [n] is greater than or equal to [length].
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"skip"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "drop"
|
||||
typeParameters = List()
|
||||
parameters = Map("n", new {
|
||||
name = "n"
|
||||
})
|
||||
}, "dropWhile", new {
|
||||
docComment = "Removes the longest prefix of this string that satisfies [predicate]."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"skipWhile"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "dropWhile"
|
||||
typeParameters = List()
|
||||
parameters = Map("predicate", new {
|
||||
name = "predicate"
|
||||
})
|
||||
}, "dropLast", new {
|
||||
docComment = """
|
||||
Removes the last [n] characters of this string.
|
||||
|
||||
Returns the empty string if [n] is greater than or equal to [length].
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"skipLast"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "dropLast"
|
||||
typeParameters = List()
|
||||
parameters = Map("n", new {
|
||||
name = "n"
|
||||
})
|
||||
}, "dropLastWhile", new {
|
||||
docComment = "Removes the longest suffix of this string that satisfies [predicate]."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"skipLastWhile"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "dropLastWhile"
|
||||
typeParameters = List()
|
||||
parameters = Map("predicate", new {
|
||||
name = "predicate"
|
||||
})
|
||||
}, "replaceFirst", new {
|
||||
docComment = """
|
||||
Replaces the first occurrence of [pattern] in this string with [replacement].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceFirst"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "replacement", new {
|
||||
name = "replacement"
|
||||
})
|
||||
}, "replaceLast", new {
|
||||
docComment = """
|
||||
Replaces the last occurrence of [pattern] in this string with [replacement].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceLast"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "replacement", new {
|
||||
name = "replacement"
|
||||
})
|
||||
}, "replaceAll", new {
|
||||
docComment = """
|
||||
Replaces all occurrences of [pattern] in this string with [replacement].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceAll"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "replacement", new {
|
||||
name = "replacement"
|
||||
})
|
||||
}, "replaceFirstMapped", new {
|
||||
docComment = """
|
||||
Replaces the first occurrence of [pattern] in this string with the return value of [mapper].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceFirstMapped"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "mapper", new {
|
||||
name = "mapper"
|
||||
})
|
||||
}, "replaceLastMapped", new {
|
||||
docComment = """
|
||||
Replaces the last occurrence of [pattern] in this string with the return value of [mapper].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceLastMapped"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "mapper", new {
|
||||
name = "mapper"
|
||||
})
|
||||
}, "replaceAllMapped", new {
|
||||
docComment = """
|
||||
Replaces all occurrences of [pattern] in this string with the return value of [mapper].
|
||||
|
||||
Returns this string unchanged if [pattern] does not occur in this string.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceAllMapped"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
}, "mapper", new {
|
||||
name = "mapper"
|
||||
})
|
||||
}, "replaceRange", new {
|
||||
docComment = """
|
||||
Replaces the characters between [start] and [exclusiveEnd] with [replacement].
|
||||
|
||||
Inserts [replacement] at index [start] if `start == exclusiveEnd`.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "replaceRange"
|
||||
typeParameters = List()
|
||||
parameters = Map("start", new {
|
||||
name = "start"
|
||||
}, "exclusiveEnd", new {
|
||||
name = "exclusiveEnd"
|
||||
}, "replacement", new {
|
||||
name = "replacement"
|
||||
})
|
||||
}, "toUpperCase", new {
|
||||
docComment = "Performs a locale-independent character-by-character conversion of this string to uppercase."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toUpperCase"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toLowerCase", new {
|
||||
docComment = "Performs a locale-independent character-by-character conversion of this string to lowercase."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toLowerCase"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "reverse", new {
|
||||
docComment = "Reverses the order of characters in this string."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "reverse"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "trim", new {
|
||||
docComment = "Removes any leading and trailing characters with Unicode property \"White_Space\" from this string."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"strip"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "trim"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "trimStart", new {
|
||||
docComment = "Removes any leading characters with Unicode property \"White_Space\" from this string."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"stripLeft"
|
||||
"stripStart"
|
||||
"stripLeading"
|
||||
"trimLeft"
|
||||
"trimLeading"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "trimStart"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "trimEnd", new {
|
||||
docComment = "Removes any trailing characters with Unicode property \"White_Space\" from this string."
|
||||
annotations = List(new {
|
||||
names {
|
||||
"stripRight"
|
||||
"stripEnd"
|
||||
"stripTrailing"
|
||||
"trimRight"
|
||||
"trimTrailin"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "trimEnd"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "padStart", new {
|
||||
docComment = """
|
||||
Increases the length of this string to [width] by adding leading [char]s.
|
||||
|
||||
Returns this string unchanged if its length is already equal to or greater than [width].
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"padLeft"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "padStart"
|
||||
typeParameters = List()
|
||||
parameters = Map("width", new {
|
||||
name = "width"
|
||||
}, "char", new {
|
||||
name = "char"
|
||||
})
|
||||
}, "padEnd", new {
|
||||
docComment = """
|
||||
Increases the length of this string to [width] by adding trailing [char]s.
|
||||
|
||||
Returns this string unchanged if its length is already equal to or greater than [width].
|
||||
"""
|
||||
annotations = List(new {
|
||||
names {
|
||||
"padRight"
|
||||
}
|
||||
})
|
||||
modifiers = Set()
|
||||
name = "padEnd"
|
||||
typeParameters = List()
|
||||
parameters = Map("width", new {
|
||||
name = "width"
|
||||
}, "char", new {
|
||||
name = "char"
|
||||
})
|
||||
}, "split", new {
|
||||
docComment = "Splits this string around matches of [pattern]."
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "split"
|
||||
typeParameters = List()
|
||||
parameters = Map("pattern", new {
|
||||
name = "pattern"
|
||||
})
|
||||
}, "capitalize", new {
|
||||
docComment = """
|
||||
Converts the first character of this string to title case.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"pigeon".capitalize() == "Pigeon"
|
||||
"pigeon bird".capitalize() == "Pigeon bird"
|
||||
"".capitalize() == ""
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "capitalize"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "decapitalize", new {
|
||||
docComment = """
|
||||
Converts the first character of this string to lower case.
|
||||
|
||||
Facts:
|
||||
```
|
||||
"Pigeon".decapitalize() == "pigeon"
|
||||
"Pigeon Bird".decapitalize() == "pigeon Bird"
|
||||
"".decapitalize() == ""
|
||||
```
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "decapitalize"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toInt", new {
|
||||
docComment = """
|
||||
Parses this string as a signed decimal (base 10) integer.
|
||||
|
||||
Throws if this string cannot be parsed as a signed decimal integer,
|
||||
or if the integer is too large to fit into [Int].
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toInt"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toIntOrNull", new {
|
||||
docComment = """
|
||||
Parses this string as a signed decimal (base 10) integer.
|
||||
|
||||
Returns [null] if this string cannot be parsed as a signed decimal integer,
|
||||
or if the integer is too large to fit into [Int].
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toIntOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toFloat", new {
|
||||
docComment = """
|
||||
Parses this string as a floating point number.
|
||||
|
||||
Throws if this string cannot be parsed as a floating point number.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toFloat"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toFloatOrNull", new {
|
||||
docComment = """
|
||||
Parses this string as a floating point number.
|
||||
|
||||
Returns [null] if this string cannot be parsed as a floating point number.
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toFloatOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toBoolean", new {
|
||||
docComment = """
|
||||
Parses `"true"` to [true] and `"false"` to [false] (case-insensitive).
|
||||
|
||||
Throws if this string is neither `"true"` nor `"false"` (case-insensitive).
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toBoolean"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
}, "toBooleanOrNull", new {
|
||||
docComment = """
|
||||
Parses `"true"` to [true] and `"false"` to [false] (case-insensitive).
|
||||
|
||||
Returns [null] if this string is neither `"true"` nor `"false"` (case-insensitive).
|
||||
"""
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "toBooleanOrNull"
|
||||
typeParameters = List()
|
||||
parameters = Map()
|
||||
})
|
||||
}
|
||||
typeArguments = List()
|
||||
})
|
||||
}
|
||||
}
|
||||
rec {
|
||||
referent {
|
||||
docComment = null
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "Rec"
|
||||
typeParameters = List()
|
||||
properties = Map("rec", new {
|
||||
docComment = null
|
||||
annotations = List()
|
||||
modifiers = Set()
|
||||
name = "rec"
|
||||
})
|
||||
methods = Map()
|
||||
}
|
||||
typeArguments = List()
|
||||
}
|
||||
@@ -159,7 +159,7 @@ external const function TypeVariable(referent: TypeParameter): TypeVariable
|
||||
/// A program declaration.
|
||||
abstract external class Declaration {
|
||||
/// The source location of this declaration.
|
||||
location: SourceLocation
|
||||
hidden location: SourceLocation
|
||||
|
||||
/// The documentation comment for this declaration, if any.
|
||||
docComment: String?
|
||||
@@ -236,12 +236,12 @@ external class Class extends TypeDeclaration {
|
||||
/// The superclass of this class.
|
||||
///
|
||||
/// All classes except [Any] have a superclass.
|
||||
superclass: Class?
|
||||
hidden superclass: Class?
|
||||
|
||||
/// The supertype of this class.
|
||||
///
|
||||
/// All classes except [Any] have a supertype.
|
||||
supertype: Type?
|
||||
hidden supertype: Type?
|
||||
|
||||
/// The properties declared in this class.
|
||||
///
|
||||
@@ -274,7 +274,7 @@ external class TypeAlias extends TypeDeclaration {
|
||||
/// A property declaration.
|
||||
external class Property extends Declaration {
|
||||
/// The declared type of this property.
|
||||
type: Type
|
||||
hidden type: Type
|
||||
|
||||
/// The (explicit or implicit) default value of this property.
|
||||
///
|
||||
@@ -293,7 +293,7 @@ external class Method extends Declaration {
|
||||
parameters: Map<String, MethodParameter>
|
||||
|
||||
/// The return type of this method.
|
||||
returnType: Type
|
||||
hidden returnType: Type
|
||||
}
|
||||
|
||||
/// A method parameter.
|
||||
@@ -302,7 +302,7 @@ external class MethodParameter {
|
||||
name: String
|
||||
|
||||
/// The type of this method parameter.
|
||||
type: Type
|
||||
hidden type: Type
|
||||
}
|
||||
|
||||
/// A type parameter of a generic type or method declaration.
|
||||
|
||||
Reference in New Issue
Block a user