JS: replace all usages of @native annotation with external modifier, in tests, stdlib, etc
This commit is contained in:
@@ -50,7 +50,7 @@ private fun Appendable.renderAttributeDeclarationAsProperty(arg: GenerateAttribu
|
||||
indent(commented, level)
|
||||
|
||||
if (arg.name in keywords) {
|
||||
append("@native(\"${arg.name}\") ")
|
||||
append("@JsName(\"${arg.name}\") ")
|
||||
}
|
||||
|
||||
renderAttributeDeclaration(arg, modality, omitDefaults)
|
||||
@@ -104,7 +104,7 @@ private fun Appendable.renderFunctionDeclaration(f: GenerateFunction, override:
|
||||
}
|
||||
|
||||
if (f.name in keywords) {
|
||||
append("@native(\"${f.name}\") ")
|
||||
append("@JsName(\"${f.name}\") ")
|
||||
}
|
||||
append("fun ${f.name.replaceKeywords()}")
|
||||
renderArgumentsDeclaration(f.arguments, override)
|
||||
@@ -120,7 +120,7 @@ private fun GenerateAttribute.isRequiredFunctionArgument(owner: String, function
|
||||
private fun GenerateFunction.fixRequiredArguments(parent: String) = copy(arguments = arguments.map { arg -> arg.copy(initializer = if (arg.isRequiredFunctionArgument(parent, name)) null else arg.initializer) })
|
||||
|
||||
fun Appendable.render(allTypes: Map<String, GenerateTraitOrClass>, typeNamesToUnions: Map<String, List<String>>, iface: GenerateTraitOrClass, markerAnnotation: Boolean = false) {
|
||||
append("@native public ")
|
||||
append("public external ")
|
||||
if (markerAnnotation) {
|
||||
append("@marker ")
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ fun specialJS(): List<GenericFunction> {
|
||||
templates add f("sort(comparison: (T, T) -> Int)") {
|
||||
only(ArraysOfObjects, ArraysOfPrimitives)
|
||||
exclude(PrimitiveType.Boolean)
|
||||
annotations("@native")
|
||||
external(true)
|
||||
returns("Unit")
|
||||
doc { "Sorts the array in-place according to the order specified by the given [comparison] function." }
|
||||
body { "noImpl" }
|
||||
|
||||
@@ -147,6 +147,7 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
|
||||
val returns = FamilyProperty<String>()
|
||||
val operator = FamilyProperty<Boolean>()
|
||||
val infix = FamilyProperty<Boolean>()
|
||||
val external = FamilyProperty<Boolean>()
|
||||
val body = object : FamilyProperty<String>() {
|
||||
override fun onKeySet(key: Family) = include(key)
|
||||
}
|
||||
@@ -410,6 +411,8 @@ class GenericFunction(val signature: String, val keyword: String = "fun") {
|
||||
}
|
||||
|
||||
builder.append("public ")
|
||||
if (external[f] == true)
|
||||
builder.append("external ")
|
||||
if (inline[f]?.isInline() == true)
|
||||
builder.append("inline ")
|
||||
if (infix[f] == true)
|
||||
|
||||
Reference in New Issue
Block a user