From cd04e794ee3027eea057fcbf8e2e7581d2e4e86d Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Thu, 19 Jan 2017 22:36:25 +0300 Subject: [PATCH] KJS: class MathClass -> object Math --- .../testData/basic/common/InExpressionNoPrefix.kt | 4 ++-- .../testData/basic/common/InExtendTypeAnnotation.kt | 4 ++-- js/js.libraries/src/core/math.kt | 8 +++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/idea/idea-completion/testData/basic/common/InExpressionNoPrefix.kt b/idea/idea-completion/testData/basic/common/InExpressionNoPrefix.kt index 0f3a3aa9f10..e70dc90027b 100644 --- a/idea/idea-completion/testData/basic/common/InExpressionNoPrefix.kt +++ b/idea/idea-completion/testData/basic/common/InExpressionNoPrefix.kt @@ -4,5 +4,5 @@ class Test { } } -// EXIST: Any, Nothing, Unit, Int, Number, Array -// EXIST_JAVA_ONLY: Math, Thread \ No newline at end of file +// EXIST: Any, Nothing, Unit, Int, Number, Array, Math +// EXIST_JAVA_ONLY: Thread \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/common/InExtendTypeAnnotation.kt b/idea/idea-completion/testData/basic/common/InExtendTypeAnnotation.kt index b9cefef7fa8..44b340ccb41 100644 --- a/idea/idea-completion/testData/basic/common/InExtendTypeAnnotation.kt +++ b/idea/idea-completion/testData/basic/common/InExtendTypeAnnotation.kt @@ -3,5 +3,5 @@ class Test : { } } -// EXIST: Any, Nothing, Unit, Int, Number, Array -// EXIST_JAVA_ONLY: Math, Thread \ No newline at end of file +// EXIST: Any, Nothing, Unit, Int, Number, Array, Math +// EXIST_JAVA_ONLY: Thread \ No newline at end of file diff --git a/js/js.libraries/src/core/math.kt b/js/js.libraries/src/core/math.kt index d9eb048f480..683548979ca 100644 --- a/js/js.libraries/src/core/math.kt +++ b/js/js.libraries/src/core/math.kt @@ -1,7 +1,7 @@ package kotlin.js //TODO: declare using number -public external class MathClass() { +public external object Math { public val PI: Double = noImpl public fun random(): Double = noImpl public fun abs(value: Double): Double = noImpl @@ -27,7 +27,5 @@ public external class MathClass() { public fun ceil(value: Number): Int = noImpl } -public external val Math: MathClass - -public fun MathClass.min(a: Long, b: Long): Long = if (a <= b) a else b -public fun MathClass.max(a: Long, b: Long): Long = if (a >= b) a else b \ No newline at end of file +public fun Math.min(a: Long, b: Long): Long = if (a <= b) a else b +public fun Math.max(a: Long, b: Long): Long = if (a >= b) a else b \ No newline at end of file