Some hacky API tweaks to conform with new stdlib APIs.
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
package kotlin
|
||||||
|
|
||||||
|
import java.util.Map as JMap
|
||||||
|
/** Provides [] access to maps */
|
||||||
|
fun <K, V> JMap<K, V>.set(key : K, value : V) = this.put(key, value)
|
||||||
@@ -135,15 +135,17 @@ public final class AnalyzerFacadeForJS {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDefaultImports(@NotNull Collection<JetImportDirective> directives) {
|
public void addDefaultImports(@NotNull Collection<JetImportDirective> directives) {
|
||||||
|
//TODO: these thing should not be hard-coded like that
|
||||||
directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("js.*")));
|
directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("js.*")));
|
||||||
directives.add(JetPsiFactory.createImportDirective(project, new ImportPath(JetStandardClasses.STANDARD_CLASSES_FQNAME, true)));
|
directives.add(JetPsiFactory.createImportDirective(project, new ImportPath(JetStandardClasses.STANDARD_CLASSES_FQNAME, true)));
|
||||||
|
directives.add(JetPsiFactory.createImportDirective(project, new ImportPath("kotlin.*")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void extendNamespaceScope(@NotNull BindingTrace trace, @NotNull NamespaceDescriptor namespaceDescriptor,
|
public void extendNamespaceScope(@NotNull BindingTrace trace, @NotNull NamespaceDescriptor namespaceDescriptor,
|
||||||
@NotNull WritableScope namespaceMemberScope) {
|
@NotNull WritableScope namespaceMemberScope) {
|
||||||
DefaultModuleConfiguration.createStandardConfiguration(project, true).extendNamespaceScope(trace, namespaceDescriptor, namespaceMemberScope);
|
DefaultModuleConfiguration.createStandardConfiguration(project, true)
|
||||||
|
.extendNamespaceScope(trace, namespaceDescriptor, namespaceMemberScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ public abstract class Config {
|
|||||||
"/raphael/raphael.kt",
|
"/raphael/raphael.kt",
|
||||||
"/html5/canvas.kt",
|
"/html5/canvas.kt",
|
||||||
"/html5/files.kt",
|
"/html5/files.kt",
|
||||||
"/html5/image.kt"
|
"/html5/image.kt",
|
||||||
|
"/stdlib/JUMaps.kt"
|
||||||
);
|
);
|
||||||
|
|
||||||
protected static final String LIBRARIES_LOCATION = "js/js.libraries/src";
|
protected static final String LIBRARIES_LOCATION = "js/js.libraries/src";
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
* See this page for details:
|
* See this page for details:
|
||||||
* http://confluence.jetbrains.net/display/Kotlin/Type-safe+Groovy-style+builders
|
* http://confluence.jetbrains.net/display/Kotlin/Type-safe+Groovy-style+builders
|
||||||
*/
|
*/
|
||||||
import js.*
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
fun main(args : Array<String>) {
|
fun main(args : Array<String>) {
|
||||||
@@ -75,7 +74,7 @@ abstract class Tag(val name : String) : Element {
|
|||||||
override fun render(builder : StringBuilder, indent : String) {
|
override fun render(builder : StringBuilder, indent : String) {
|
||||||
builder.append("$indent<$name${renderAttributes()}>\n")
|
builder.append("$indent<$name${renderAttributes()}>\n")
|
||||||
for (c in children) {
|
for (c in children) {
|
||||||
c.render(builder, indent + " ")
|
c?.render(builder, indent + " ")
|
||||||
}
|
}
|
||||||
builder.append("$indent</$name>\n")
|
builder.append("$indent</$name>\n")
|
||||||
}
|
}
|
||||||
@@ -129,7 +128,7 @@ class P() : BodyTag("p")
|
|||||||
class H1() : BodyTag("h1")
|
class H1() : BodyTag("h1")
|
||||||
class A() : BodyTag("a") {
|
class A() : BodyTag("a") {
|
||||||
public var href : String
|
public var href : String
|
||||||
get() = attributes["href"]
|
get() = attributes["href"].sure()
|
||||||
set(value) {
|
set(value) {
|
||||||
attributes["href"] = value
|
attributes["href"] = value
|
||||||
}
|
}
|
||||||
@@ -140,6 +139,3 @@ fun html(init : HTML.() -> Unit) : HTML {
|
|||||||
html.init()
|
html.init()
|
||||||
return html
|
return html
|
||||||
}
|
}
|
||||||
|
|
||||||
// An excerpt from the Standard Library
|
|
||||||
fun <K, V> Map<K, V>.set(key : K, value : V) = this.put(key, value)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user