more of the stdlib compiling to JS
This commit is contained in:
@@ -21,7 +21,6 @@ public trait Iterator<T> {
|
|||||||
open fun remove() : Unit = js.noImpl
|
open fun remove() : Unit = js.noImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
library
|
|
||||||
val Collections = object {
|
val Collections = object {
|
||||||
library("collectionsMax")
|
library("collectionsMax")
|
||||||
public fun max<T>(col : Collection<T>, comp : Comparator<T>) : T = js.noImpl
|
public fun max<T>(col : Collection<T>, comp : Comparator<T>) : T = js.noImpl
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class StdLibTestToJSTest extends StdLibTestSupport {
|
|||||||
|
|
||||||
generateJavaScriptFiles(EcmaVersion.all(),
|
generateJavaScriptFiles(EcmaVersion.all(),
|
||||||
"libraries/stdlib/test",
|
"libraries/stdlib/test",
|
||||||
|
"ListTest.kt",
|
||||||
"StringTest.kt",
|
"StringTest.kt",
|
||||||
"js/SimpleTest.kt");
|
"js/SimpleTest.kt");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public class StdLibToJSTest extends StdLibTestSupport {
|
|||||||
generateJavaScriptFiles(EcmaVersion.all(),
|
generateJavaScriptFiles(EcmaVersion.all(),
|
||||||
"libraries/stdlib/src",
|
"libraries/stdlib/src",
|
||||||
"kotlin/Preconditions.kt",
|
"kotlin/Preconditions.kt",
|
||||||
// TODO re-enable when we've got the filter stuff ported to JS
|
"kotlin/dom/Dom.kt",
|
||||||
//"kotlin/dom/Dom.kt",
|
|
||||||
"kotlin/support/AbstractIterator.kt");
|
"kotlin/support/AbstractIterator.kt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import java.lang.IndexOutOfBoundsException
|
|||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
|
||||||
|
private val EmptyElementList: List<Element> = Collections.emptyList<Element>()!!
|
||||||
|
private val EmptyNodeList: List<Node> = Collections.emptyList<Node>()!!
|
||||||
|
|
||||||
var Node.text : String
|
var Node.text : String
|
||||||
get() {
|
get() {
|
||||||
return textContent
|
return textContent
|
||||||
@@ -120,8 +123,7 @@ inline fun Document?.elements(namespaceUri: String, localName: String): List<Ele
|
|||||||
inline fun NodeList?.toList(): List<Node> {
|
inline fun NodeList?.toList(): List<Node> {
|
||||||
return if (this == null) {
|
return if (this == null) {
|
||||||
// TODO the following is easier to convert to JS
|
// TODO the following is easier to convert to JS
|
||||||
//Collections.EMPTY_LIST as List<Node>
|
EmptyNodeList
|
||||||
ArrayList<Node>()
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NodeListAsList(this)
|
NodeListAsList(this)
|
||||||
@@ -131,7 +133,7 @@ inline fun NodeList?.toList(): List<Node> {
|
|||||||
inline fun NodeList?.toElementList(): List<Element> {
|
inline fun NodeList?.toElementList(): List<Element> {
|
||||||
return if (this == null) {
|
return if (this == null) {
|
||||||
// TODO the following is easier to convert to JS
|
// TODO the following is easier to convert to JS
|
||||||
//Collections.EMPTY_LIST as List<Element>
|
//EmptyElementList
|
||||||
ArrayList<Element>()
|
ArrayList<Element>()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -153,13 +155,13 @@ fun Document?.get(selector: String): List<Element> {
|
|||||||
return if (element != null)
|
return if (element != null)
|
||||||
arrayList<Element>(element)
|
arrayList<Element>(element)
|
||||||
else
|
else
|
||||||
Collections.EMPTY_LIST as List<Element>
|
EmptyElementList
|
||||||
} else {
|
} else {
|
||||||
// assume its a vanilla element name
|
// assume its a vanilla element name
|
||||||
elements(selector)
|
elements(selector)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Collections.EMPTY_LIST as List<Element>
|
EmptyElementList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +176,7 @@ fun Element.get(selector: String): List<Element> {
|
|||||||
return if (element != null)
|
return if (element != null)
|
||||||
arrayList<Element>(element)
|
arrayList<Element>(element)
|
||||||
else
|
else
|
||||||
Collections.EMPTY_LIST as List<Element>
|
EmptyElementList
|
||||||
} else {
|
} else {
|
||||||
// assume its a vanilla element name
|
// assume its a vanilla element name
|
||||||
elements(selector)
|
elements(selector)
|
||||||
|
|||||||
@@ -53,12 +53,10 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${basedir}/target/generated-js-library/kotlin">
|
<copy todir="${basedir}/target/generated-js-library/kotlin">
|
||||||
<!--
|
|
||||||
<fileset dir="${basedir}/../../stdlib/src/kotlin/dom">
|
<fileset dir="${basedir}/../../stdlib/src/kotlin/dom">
|
||||||
<include name="**/*.kt"/>
|
<include name="**/*.kt"/>
|
||||||
<exclude name="**/*JVM.kt"/>
|
<exclude name="**/*JVM.kt"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
-->
|
|
||||||
<fileset dir="${basedir}/../../stdlib/src/kotlin/support">
|
<fileset dir="${basedir}/../../stdlib/src/kotlin/support">
|
||||||
<include name="**/*.kt"/>
|
<include name="**/*.kt"/>
|
||||||
<exclude name="**/*JVM.kt"/>
|
<exclude name="**/*JVM.kt"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user