Fix visibility of @JsName-annotated symbols in stdlib-js

This commit is contained in:
Roman Artemev
2018-05-28 22:29:36 +03:00
committed by Roman Artemev
parent 06009a532b
commit 9d2092e86d
2 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -5,7 +5,7 @@
package kotlin.io
private abstract class BaseOutput {
internal abstract class BaseOutput {
open fun println() {
print("\n")
}
@@ -22,13 +22,13 @@ private abstract class BaseOutput {
/** JsName used to make the declaration available outside of module to test it */
@JsName("NodeJsOutput")
private class NodeJsOutput(val outputStream: dynamic) : BaseOutput() {
internal class NodeJsOutput(val outputStream: dynamic) : BaseOutput() {
override fun print(message: Any?) = outputStream.write(String(message))
}
/** JsName used to make the declaration available outside of module to test it */
@JsName("OutputToConsoleLog")
private class OutputToConsoleLog : BaseOutput() {
internal class OutputToConsoleLog : BaseOutput() {
override fun print(message: Any?) {
console.log(message)
}
@@ -44,7 +44,7 @@ private class OutputToConsoleLog : BaseOutput() {
/** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */
@JsName("BufferedOutput")
private open class BufferedOutput : BaseOutput() {
internal open class BufferedOutput : BaseOutput() {
var buffer = ""
override fun print(message: Any?) {
@@ -58,7 +58,7 @@ private open class BufferedOutput : BaseOutput() {
/** JsName used to make the declaration available outside of module to test it */
@JsName("BufferedOutputToConsoleLog")
private class BufferedOutputToConsoleLog : BufferedOutput() {
internal class BufferedOutputToConsoleLog : BufferedOutput() {
override fun print(message: Any?) {
var s = String(message)
val i = s.lastIndexOf('\n')
@@ -78,7 +78,7 @@ private class BufferedOutputToConsoleLog : BufferedOutput() {
/** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */
@JsName("output")
private var output = run {
internal var output = run {
val isNode: Boolean = js("typeof process !== 'undefined' && process.versions && !!process.versions.node")
if (isNode) NodeJsOutput(js("process.stdout")) else BufferedOutputToConsoleLog()
}
@@ -6,21 +6,21 @@
// a package is omitted to get declarations directly under the module
@JsName("throwNPE")
private fun throwNPE(message: String) {
internal fun throwNPE(message: String) {
throw NullPointerException(message)
}
@JsName("throwCCE")
private fun throwCCE() {
internal fun throwCCE() {
throw ClassCastException("Illegal cast")
}
@JsName("throwISE")
private fun throwISE(message: String) {
internal fun throwISE(message: String) {
throw IllegalStateException(message)
}
@JsName("throwUPAE")
private fun throwUPAE(propertyName: String) {
internal fun throwUPAE(propertyName: String) {
throw UninitializedPropertyAccessException("lateinit property ${propertyName} has not been initialized")
}