Extension functions + functions type with receivers

This commit is contained in:
Andrey Breslav
2010-11-22 17:08:19 +03:00
parent 171a5250f8
commit 5794ab6120
4 changed files with 48 additions and 4 deletions
+43
View File
@@ -0,0 +1,43 @@
object AntBuilder() {
lazy val groovy = library {
classpath("$libs/groovy-...")
}
lazy val gant = library {
new File("$gantHome/lib").files.each {
classpath(it)
}
}
lazy val JPS = module {
targetLevel = "1.5"
classpath(antLayout, gant, groovy)
src("$projectHome/antLayout/src")
}
}.build()
class AntBuilder {
abstract class ClassPathEntry {}
class Module : ClassPathEntry {
fun classpath(entries : ClassPathEntry...) { ... }
var targetLevel : String
fun src(src : String) { ... }
}
class Library : ClassPathEntry {
fun classpath(entries : ClassPathEntry...) { ... }
}
fun library(initializer : Library.{ => Library}) {
val lib = new Library()
initializer(lib)
return lib
}
fun classpath
fun module
}