@nstudio/nativescript-compiler 9.2.0-alpha.10 → 9.2.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ir.js +7 -1
- package/dist/driver/cli.js +2 -0
- package/dist/driver/compile.js +22 -10
- package/dist/driver/unimplemented.js +15 -0
- package/dist/kotlin/access.js +22 -4
- package/dist/kotlin/arguments.js +5 -0
- package/dist/kotlin/builtins.js +0 -4
- package/dist/kotlin/calls.js +6 -2
- package/dist/kotlin/class-methods.js +9 -3
- package/dist/kotlin/components.js +13 -8
- package/dist/kotlin/core-api.js +2 -13
- package/dist/kotlin/declarations.js +2 -0
- package/dist/kotlin/expression-statements.js +5 -4
- package/dist/kotlin/functions.js +13 -4
- package/dist/kotlin/global-calls.js +11 -0
- package/dist/kotlin/literals.js +51 -5
- package/dist/kotlin/names.js +2 -2
- package/dist/kotlin/native/api.js +9 -1
- package/dist/kotlin/native/subclasses.js +4 -3
- package/dist/kotlin/native/types.js +8 -5
- package/dist/kotlin/operators.js +4 -1
- package/dist/kotlin/prototype-calls.js +5 -0
- package/dist/kotlin/render.js +62 -0
- package/dist/kotlin/statements.js +9 -0
- package/dist/kotlin/static-calls.js +4 -3
- package/dist/kotlin/types.js +6 -6
- package/dist/plugins/native-android.js +7 -3
- package/dist/plugins/native-ios.js +2 -0
- package/dist/plugins/source.js +73 -23
- package/dist/program/app-modules.js +91 -16
- package/dist/program/app-paths.js +80 -12
- package/dist/program/class-mixins.js +463 -0
- package/dist/program/core-facts.js +7 -0
- package/dist/program/glob.js +274 -0
- package/dist/program/platform.js +32 -4
- package/dist/program/program.js +212 -20
- package/dist/program/source-lines.js +4 -1
- package/dist/program/vite-plugins.js +144 -0
- package/dist/semantics/apis/globals.js +2 -2
- package/dist/semantics/apis/object.js +1 -0
- package/dist/semantics/apis/statics.js +6 -0
- package/dist/semantics/ast.js +20 -2
- package/dist/semantics/classes.js +36 -1
- package/dist/semantics/globals.js +3 -0
- package/dist/semantics/lang.js +13 -1
- package/dist/semantics/nullish.js +29 -11
- package/dist/semantics/refuse-receivers.js +3 -3
- package/dist/semantics/refuse-scope.js +2 -7
- package/dist/semantics/runtime.js +1 -0
- package/dist/semantics/states/value-states.js +1 -1
- package/dist/semantics/throws.js +1 -0
- package/dist/semantics/translator-methods.js +1 -1
- package/dist/semantics/types.js +21 -1
- package/dist/swift/access.js +25 -10
- package/dist/swift/arguments.js +10 -2
- package/dist/swift/assignment.js +12 -1
- package/dist/swift/builtins.js +0 -4
- package/dist/swift/calls.js +6 -2
- package/dist/swift/class-methods.js +3 -3
- package/dist/swift/components.js +28 -8
- package/dist/swift/construction.js +4 -0
- package/dist/swift/core-api.js +9 -12
- package/dist/swift/functions.js +13 -2
- package/dist/swift/generics.js +5 -1
- package/dist/swift/global-calls.js +2 -0
- package/dist/swift/literals.js +53 -6
- package/dist/swift/names.js +1 -1
- package/dist/swift/native/sdk-tables.js +52 -4
- package/dist/swift/native/sdk.js +9 -1
- package/dist/swift/operators.js +4 -1
- package/dist/swift/parameters.js +5 -2
- package/dist/swift/placement.js +42 -1
- package/dist/swift/prototype-calls.js +17 -2
- package/dist/swift/render.js +64 -0
- package/dist/swift/results.js +1 -1
- package/dist/swift/statements.js +9 -0
- package/dist/swift/static-calls.js +8 -3
- package/dist/swift/types.js +9 -9
- package/dist/targets/android/build.js +13 -9
- package/dist/targets/ios/build.js +11 -10
- package/dist/targets/ios/dependencies.js +12 -0
- package/dist/targets/resources.js +15 -1
- package/dist/template/plan.js +105 -8
- package/dist/types/adapter-api.d.ts +13 -0
- package/dist/types/ir.d.ts +47 -0
- package/kit-android/generated/kotlin/org/nativescript/kit/__Objects.kt +102 -7485
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_view_common.kt +1 -3
- package/kit-android/generated/source-lines.json +1 -1
- package/kit-android/src/fromcore/kotlin/org/nativescript/kit/CoreBridge.kt +67 -1
- package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Prototypes.kt +26 -0
- package/kit-apple/Overlays/xml-free/Core/ui.core.bindable.index.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity1.swift +24 -146
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity2.swift +0 -281
- package/kit-apple/Sources/NativeScriptKit/Core/{Object_iterator_prototype_for_keyFor_hasInstance_isConcatSpreadable_and_19_more_91b5f3.swift → Object_iterator_prototype_for_keyFor_hasInstance_isConcatSpreadable_and_19_more_fa18e1.swift} +28 -103
- package/kit-apple/Sources/NativeScriptKit/Core/__Namespace.Utils.swift +17 -15
- package/kit-apple/Sources/NativeScriptKit/Core/application-settings.index.ios.swift +8 -8
- package/kit-apple/Sources/NativeScriptKit/Core/application.application-common.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/color.color-common.swift +7 -7
- package/kit-apple/Sources/NativeScriptKit/Core/http.http-request-internal.index.ios.swift +2 -1
- package/kit-apple/Sources/NativeScriptKit/Core/image-source.index.ios.swift +1 -1
- package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +34 -244
- package/kit-apple/Sources/NativeScriptKit/Core/manifest.json +1 -2
- package/kit-apple/Sources/NativeScriptKit/Core/ui.action-bar.index.ios.swift +3 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.button.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.content-view.index.swift +8 -8
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.bindable.index.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.index.ios.swift +8 -8
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.view-common.swift +1 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.view-helper.view-helper-common.swift +7 -7
- package/kit-apple/Sources/NativeScriptKit/Core/ui.frame.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.html-view.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.image.image-common.swift +2 -2
- package/kit-apple/Sources/NativeScriptKit/Core/ui.image.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.label.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.absolute-layout.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.dock-layout.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.flexbox-layout.index.ios.swift +3 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.grid-layout.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.stack-layout.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.wrap-layout.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.list-view.index.ios.swift +3 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.page.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.repeater.index.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.scroll-view.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.split-view.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.background.ios.swift +1 -1
- package/kit-apple/Sources/NativeScriptKit/Core/ui.tab-view.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/utils.common.swift +9 -9
- package/kit-apple/Sources/NativeScriptKit/Core/utils.layout-helper.index.ios.swift +10 -10
- package/kit-apple/Sources/NativeScriptKit/CoreBridge.swift +67 -1
- package/kit-apple/Sources/NativeScriptKit/Runtime/Lowering.swift +4 -0
- package/kit-apple/Sources/NativeScriptKit/Runtime/Prototypes.swift +25 -0
- package/kit-apple/Sources/NativeScriptKit/Runtime/RegExp.swift +6 -0
- package/package.json +1 -1
- package/kit-apple/Sources/NativeScriptKit/Core/Object_toString_charAt_charCodeAt_concat_indexOf_lastIndexOf_and_44_more_fc25df.swift +0 -481
|
@@ -5,6 +5,49 @@ package org.nativescript.kit
|
|
|
5
5
|
// a framework's renderer adds them, properties set as the XML builder
|
|
6
6
|
// sets them, errors reported as core reports what nothing catches.
|
|
7
7
|
|
|
8
|
+
/** Registered `ViewClassMeta` (`insertChild` / `removeChild`) hooks from `registerElement(tag, () => Class, meta)`. */
|
|
9
|
+
private object ViewMetaRegistry {
|
|
10
|
+
data class Entry(val insertChild: Any?, val removeChild: Any?)
|
|
11
|
+
private val byName = HashMap<String, Entry>()
|
|
12
|
+
private val byClass = HashMap<Class<*>, Entry>()
|
|
13
|
+
|
|
14
|
+
fun register(tag: String, resolver: Any?, meta: Any?) {
|
|
15
|
+
val m = jsBox(meta)
|
|
16
|
+
if (jsIsNullish(m)) return
|
|
17
|
+
val insertChild = jsGet(m, "insertChild").let { if (jsIsNullish(it)) null else it }
|
|
18
|
+
val removeChild = jsGet(m, "removeChild").let { if (jsIsNullish(it)) null else it }
|
|
19
|
+
if (insertChild == null && removeChild == null) return
|
|
20
|
+
val entry = Entry(insertChild, removeChild)
|
|
21
|
+
byName[tag.lowercase()] = entry
|
|
22
|
+
val ctor = try { if (!jsIsNullish(resolver)) jsCall(resolver) else null } catch (_: Throwable) { null }
|
|
23
|
+
when (ctor) {
|
|
24
|
+
is Class<*> -> {
|
|
25
|
+
byClass[ctor] = entry
|
|
26
|
+
byName[ctor.simpleName.lowercase()] = entry
|
|
27
|
+
}
|
|
28
|
+
else -> if (ctor != null && !jsIsNullish(ctor)) {
|
|
29
|
+
val name = jsConstructorName(ctor)
|
|
30
|
+
if (name.isNotEmpty() && name != "Object") byName[name.lowercase()] = entry
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fun meta(owner: ViewBase): Entry? {
|
|
36
|
+
var c: Class<*>? = owner.javaClass
|
|
37
|
+
while (c != null && c != Any::class.java) {
|
|
38
|
+
byClass[c]?.let { return it }
|
|
39
|
+
byName[c.simpleName.lowercase()]?.let { return it }
|
|
40
|
+
c = c.superclass
|
|
41
|
+
}
|
|
42
|
+
return byName[jsConstructorName(owner).lowercase()]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Registers a plugin element's `ViewClassMeta` (`insertChild` / `removeChild`) so compiled templates attach children through it. */
|
|
47
|
+
fun kitRegisterViewMeta(tag: String, resolver: Any?, meta: Any?) {
|
|
48
|
+
ViewMetaRegistry.register(tag, resolver, meta)
|
|
49
|
+
}
|
|
50
|
+
|
|
8
51
|
/** The template children of a container: its static views and its regions, in template order. */
|
|
9
52
|
class TemplateChildren internal constructor(owner: ViewBase) : RegionHost {
|
|
10
53
|
private val owner = java.lang.ref.WeakReference(owner)
|
|
@@ -31,7 +74,30 @@ class TemplateChildren internal constructor(owner: ViewBase) : RegionHost {
|
|
|
31
74
|
val owner = owner.get() ?: return
|
|
32
75
|
val next = parts.flatMap { it.views }
|
|
33
76
|
jsReport {
|
|
34
|
-
|
|
77
|
+
val meta = ViewMetaRegistry.meta(owner)
|
|
78
|
+
if (meta != null) {
|
|
79
|
+
val kept = next.toSet()
|
|
80
|
+
val active = ArrayList<ViewBase>()
|
|
81
|
+
for (old in placed) {
|
|
82
|
+
if (old in kept) active.add(old)
|
|
83
|
+
else if (meta.removeChild != null) jsCall(meta.removeChild, owner, old)
|
|
84
|
+
}
|
|
85
|
+
val keptOrder = next.filter { v -> active.any { it === v } }
|
|
86
|
+
if (active.size == keptOrder.size && active.indices.any { active[it] !== keptOrder[it] } && meta.removeChild != null) {
|
|
87
|
+
for (old in active) jsCall(meta.removeChild, owner, old)
|
|
88
|
+
active.clear()
|
|
89
|
+
}
|
|
90
|
+
val activeSet = java.util.Collections.newSetFromMap(java.util.IdentityHashMap<ViewBase, Boolean>())
|
|
91
|
+
activeSet.addAll(active)
|
|
92
|
+
if (meta.insertChild != null) {
|
|
93
|
+
for ((index, view) in next.withIndex()) {
|
|
94
|
+
if (activeSet.contains(view)) continue
|
|
95
|
+
val nextSibling = next.subList(index + 1, next.size).firstOrNull { activeSet.contains(it) }
|
|
96
|
+
jsCall(meta.insertChild, owner, view, nextSibling)
|
|
97
|
+
activeSet.add(view)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} else when (owner) {
|
|
35
101
|
is LayoutBase -> {
|
|
36
102
|
val kept = next.toSet()
|
|
37
103
|
for (old in placed) if (old !in kept && old is View) owner.removeChild(old)
|
|
@@ -90,9 +90,16 @@ object JSPrototypes {
|
|
|
90
90
|
/** The prototype a built-in kind of value has (`Array.prototype`), its own object. */
|
|
91
91
|
fun builtin(name: String): JSObject = builtins[name] ?: builtins.computeIfAbsent(name) { JSObject() }
|
|
92
92
|
|
|
93
|
+
private val customPrototypes = java.util.Collections.synchronizedMap(java.util.WeakHashMap<Any, Any?>())
|
|
94
|
+
|
|
95
|
+
fun setPrototype(target: Any, proto: Any?) {
|
|
96
|
+
customPrototypes[target] = proto
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
/** `Object.getPrototypeOf` of a plain object: a class's prototype leads to its superclass's. */
|
|
94
100
|
fun prototypeOf(o: JSObject): Any? {
|
|
95
101
|
if (o === objectPrototype || o.jsNullPrototype) return jsNull
|
|
102
|
+
if (customPrototypes.containsKey(o)) return customPrototypes[o]
|
|
96
103
|
val superclass = owners[o]?.superclass
|
|
97
104
|
if (superclass != null && superclass != Any::class.java) return of(superclass)
|
|
98
105
|
return objectPrototype
|
|
@@ -145,6 +152,25 @@ internal fun jsClassGet(cls: Class<*>, key: String): Any? {
|
|
|
145
152
|
return jsJavaGet(cls, key)
|
|
146
153
|
}
|
|
147
154
|
|
|
155
|
+
/** `Object.setPrototypeOf(target, proto)`. */
|
|
156
|
+
fun jsSetPrototypeOf(target: Any?, proto: Any?): Any? {
|
|
157
|
+
val v = jsBox(target)
|
|
158
|
+
if (v == null || v === JSNull) throw JSException(JSTypeError("Object.setPrototypeOf called on null or undefined"))
|
|
159
|
+
val p = jsBox(proto)
|
|
160
|
+
if (p != null && p !== JSNull && p !is JSObject && p !is JSDynamic && p !is Class<*>) throw JSException(JSTypeError("Object prototype may only be an Object or null"))
|
|
161
|
+
if (v is JSObject) {
|
|
162
|
+
if (p == null || p === JSNull) {
|
|
163
|
+
v.jsPrototype = null
|
|
164
|
+
v.jsNullPrototype = true
|
|
165
|
+
} else {
|
|
166
|
+
v.jsPrototype = p
|
|
167
|
+
v.jsNullPrototype = false
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
JSPrototypes.setPrototype(v, if (p == null || p === JSNull) jsNull else p)
|
|
171
|
+
return target
|
|
172
|
+
}
|
|
173
|
+
|
|
148
174
|
/** `Object.getPrototypeOf(value)`. */
|
|
149
175
|
fun jsGetPrototypeOf(value: Any?): Any? = when (val v = jsBox(value)) {
|
|
150
176
|
null, JSNull -> throw JSException(JSTypeError("Cannot convert undefined or null to object"))
|
|
@@ -214,7 +214,7 @@ open class Binding: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
214
214
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:202)
|
|
215
215
|
source = self.sourceAsObject(source)
|
|
216
216
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:204)
|
|
217
|
-
if !Core_utils_types.isNullOrUndefined(source) {
|
|
217
|
+
if try !Core_utils_types.isNullOrUndefined(source) {
|
|
218
218
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:206)
|
|
219
219
|
self.source = try JSWeakRef<AnyObject>(jsCoreWeakTarget(source))
|
|
220
220
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:207)
|
|
@@ -568,7 +568,7 @@ open class Binding: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
568
568
|
return jsTruthy(__v_3) ? __v_3 : jsGlobalThis
|
|
569
569
|
}())
|
|
570
570
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:380)
|
|
571
|
-
let resources: Any? = Core_ui_core_bindable_bindable_resources.get()
|
|
571
|
+
let resources: Any? = try Core_ui_core_bindable_bindable_resources.get()
|
|
572
572
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:381)
|
|
573
573
|
for prop in jsKeysOf(resources) {
|
|
574
574
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:382)
|
|
@@ -762,7 +762,7 @@ open class Binding: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
762
762
|
jsKey: jsToString(
|
|
763
763
|
jsUnwrap(sourceProps, "changedPropertyIndex").element(changedPropertyIndex) as Any?)]
|
|
764
764
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:464)
|
|
765
|
-
if !Core_utils_types.isNullOrUndefined(newObject) && jsStringEquals(jsTypeof(newObject), "object") {
|
|
765
|
+
if try !Core_utils_types.isNullOrUndefined(newObject) && jsStringEquals(jsTypeof(newObject), "object") {
|
|
766
766
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:465)
|
|
767
767
|
try self.addPropertyChangeListeners(
|
|
768
768
|
JSWeakRef<AnyObject>(jsCoreWeakTarget(newObject)), newProps, parentProps)
|
|
@@ -980,7 +980,7 @@ open class Binding: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
980
980
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:581)
|
|
981
981
|
indexAsInt -= 1
|
|
982
982
|
}
|
|
983
|
-
} else if Core_utils_types.isString(index) {
|
|
983
|
+
} else if try Core_utils_types.isString(index) {
|
|
984
984
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:584)
|
|
985
985
|
let normalizedIndex: String = jsLenientString(index).lowercased()
|
|
986
986
|
#sourceLocation(file:"@nativescript/core/ui.core.bindable.index.ts",line:585)
|
|
@@ -1174,20 +1174,6 @@ public struct FunctionCell_Double_to_String {
|
|
|
1174
1174
|
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double) throws -> String)?)
|
|
1175
1175
|
-> JSFunctionObject?
|
|
1176
1176
|
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
1177
|
-
public static func fromScript(_ __f: Any?) -> (Double) throws -> String {
|
|
1178
|
-
if let __t = jsFlat(__f) as? (Double) throws -> String { return __t }
|
|
1179
|
-
let __i = JSFunctionAlias(of: __f)
|
|
1180
|
-
return jsIdentified(
|
|
1181
|
-
Self(f: { (__p0: Double) throws -> String in
|
|
1182
|
-
return try withExtendedLifetime(__i) { () throws -> String in
|
|
1183
|
-
return (try jsConvertedString(try jsCall(__f, __p0)))
|
|
1184
|
-
}
|
|
1185
|
-
}), __i
|
|
1186
|
-
).f
|
|
1187
|
-
}
|
|
1188
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Double) throws -> String)? {
|
|
1189
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
1190
|
-
}
|
|
1191
1177
|
}
|
|
1192
1178
|
|
|
1193
1179
|
public struct FunctionCell_ViewOpt_to_UIViewControllerOpt {
|
|
@@ -4305,20 +4291,6 @@ public struct FunctionCell_Double_to_Double {
|
|
|
4305
4291
|
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double) throws -> Double)?)
|
|
4306
4292
|
-> JSFunctionObject?
|
|
4307
4293
|
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4308
|
-
public static func fromScript(_ __f: Any?) -> (Double) throws -> Double {
|
|
4309
|
-
if let __t = jsFlat(__f) as? (Double) throws -> Double { return __t }
|
|
4310
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4311
|
-
return jsIdentified(
|
|
4312
|
-
Self(f: { (__p0: Double) throws -> Double in
|
|
4313
|
-
return try withExtendedLifetime(__i) { () throws -> Double in
|
|
4314
|
-
return (try jsConvertedNumber(try jsCall(__f, __p0)))
|
|
4315
|
-
}
|
|
4316
|
-
}), __i
|
|
4317
|
-
).f
|
|
4318
|
-
}
|
|
4319
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Double) throws -> Double)? {
|
|
4320
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4321
|
-
}
|
|
4322
4294
|
}
|
|
4323
4295
|
|
|
4324
4296
|
public struct FunctionCell_TokenTypeOpt_to_Bool {
|
|
@@ -5975,6 +5947,18 @@ public struct FunctionCell_String_to_JSSymbol {
|
|
|
5975
5947
|
guard let value else { throw jsNoObject() }
|
|
5976
5948
|
return value
|
|
5977
5949
|
}
|
|
5950
|
+
public static func script(_ name: String, _ length: Int, _ __f: @escaping (String) throws -> JSSymbol)
|
|
5951
|
+
-> JSFunctionObject
|
|
5952
|
+
{
|
|
5953
|
+
jsBoxedFunction(Self(f: __f)) {
|
|
5954
|
+
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
5955
|
+
return try __f((try jsConvertedString(jsArg(__a, 0))))
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5959
|
+
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((String) throws -> JSSymbol)?)
|
|
5960
|
+
-> JSFunctionObject?
|
|
5961
|
+
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
5978
5962
|
public static func fromScript(_ __f: Any?) -> (String) throws -> JSSymbol {
|
|
5979
5963
|
if let __t = jsFlat(__f) as? (String) throws -> JSSymbol { return __t }
|
|
5980
5964
|
let __i = JSFunctionAlias(of: __f)
|
|
@@ -5989,18 +5973,6 @@ public struct FunctionCell_String_to_JSSymbol {
|
|
|
5989
5973
|
public static func fromScriptOrNil(_ __f: Any?) -> ((String) throws -> JSSymbol)? {
|
|
5990
5974
|
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
5991
5975
|
}
|
|
5992
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (String) throws -> JSSymbol)
|
|
5993
|
-
-> JSFunctionObject
|
|
5994
|
-
{
|
|
5995
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
5996
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
5997
|
-
return try __f((try jsConvertedString(jsArg(__a, 0))))
|
|
5998
|
-
}
|
|
5999
|
-
}
|
|
6000
|
-
}
|
|
6001
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((String) throws -> JSSymbol)?)
|
|
6002
|
-
-> JSFunctionObject?
|
|
6003
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6004
5976
|
}
|
|
6005
5977
|
|
|
6006
5978
|
public struct FunctionCell_JSSymbol_to_String {
|
|
@@ -6010,6 +5982,18 @@ public struct FunctionCell_JSSymbol_to_String {
|
|
|
6010
5982
|
guard let value else { throw jsNoObject() }
|
|
6011
5983
|
return value
|
|
6012
5984
|
}
|
|
5985
|
+
public static func script(_ name: String, _ length: Int, _ __f: @escaping (JSSymbol) throws -> String)
|
|
5986
|
+
-> JSFunctionObject
|
|
5987
|
+
{
|
|
5988
|
+
jsBoxedFunction(Self(f: __f)) {
|
|
5989
|
+
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
5990
|
+
return try __f((try jsChecked(jsArg(__a, 0), JSSymbol.self)))
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((JSSymbol) throws -> String)?)
|
|
5995
|
+
-> JSFunctionObject?
|
|
5996
|
+
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6013
5997
|
public static func fromScript(_ __f: Any?) -> (JSSymbol) throws -> String {
|
|
6014
5998
|
if let __t = jsFlat(__f) as? (JSSymbol) throws -> String { return __t }
|
|
6015
5999
|
let __i = JSFunctionAlias(of: __f)
|
|
@@ -6024,18 +6008,6 @@ public struct FunctionCell_JSSymbol_to_String {
|
|
|
6024
6008
|
public static func fromScriptOrNil(_ __f: Any?) -> ((JSSymbol) throws -> String)? {
|
|
6025
6009
|
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
6026
6010
|
}
|
|
6027
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (JSSymbol) throws -> String)
|
|
6028
|
-
-> JSFunctionObject
|
|
6029
|
-
{
|
|
6030
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
6031
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
6032
|
-
return try __f((try jsChecked(jsArg(__a, 0), JSSymbol.self)))
|
|
6033
|
-
}
|
|
6034
|
-
}
|
|
6035
|
-
}
|
|
6036
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((JSSymbol) throws -> String)?)
|
|
6037
|
-
-> JSFunctionObject?
|
|
6038
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6039
6011
|
}
|
|
6040
6012
|
|
|
6041
6013
|
public struct FunctionCell_Object_x_yOpt_to_JSArray_AnyOpt_Opt {
|
|
@@ -6305,100 +6277,6 @@ public struct FunctionCell_String_to_JSArray_InheritedCssPropertyOpt_AnyOpt {
|
|
|
6305
6277
|
}
|
|
6306
6278
|
}
|
|
6307
6279
|
|
|
6308
|
-
public struct FunctionCell_AnyOpt_to_JSMatchOpt {
|
|
6309
|
-
public let f: (Any?) throws -> JSMatch?
|
|
6310
|
-
public static func implicit(_ value: ((Any?) throws -> JSMatch?)?) -> ((Any?) throws -> JSMatch?)? { value }
|
|
6311
|
-
public static func present(_ value: ((Any?) throws -> JSMatch?)?) throws -> (Any?) throws -> JSMatch? {
|
|
6312
|
-
guard let value else { throw jsNoObject() }
|
|
6313
|
-
return value
|
|
6314
|
-
}
|
|
6315
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Any?) throws -> JSMatch?)
|
|
6316
|
-
-> JSFunctionObject
|
|
6317
|
-
{
|
|
6318
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
6319
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in return try __f(jsArg(__a, 0)) }
|
|
6320
|
-
}
|
|
6321
|
-
}
|
|
6322
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Any?) throws -> JSMatch?)?)
|
|
6323
|
-
-> JSFunctionObject?
|
|
6324
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6325
|
-
}
|
|
6326
|
-
|
|
6327
|
-
public struct FunctionCell_JSRegExpOpt_to_JSArray_JSMatch_Opt {
|
|
6328
|
-
public let f: (JSRegExp?) throws -> JSArray<JSMatch>?
|
|
6329
|
-
public static func implicit(_ value: ((JSRegExp?) throws -> JSArray<JSMatch>?)?) -> (
|
|
6330
|
-
(JSRegExp?) throws -> JSArray<JSMatch>?
|
|
6331
|
-
)? { value }
|
|
6332
|
-
public static func present(_ value: ((JSRegExp?) throws -> JSArray<JSMatch>?)?) throws -> (JSRegExp?) throws ->
|
|
6333
|
-
JSArray<JSMatch>?
|
|
6334
|
-
{
|
|
6335
|
-
guard let value else { throw jsNoObject() }
|
|
6336
|
-
return value
|
|
6337
|
-
}
|
|
6338
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (JSRegExp?) throws -> JSArray<JSMatch>?)
|
|
6339
|
-
-> JSFunctionObject
|
|
6340
|
-
{
|
|
6341
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
6342
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in return try __f((jsArg(__a, 0) as? JSRegExp)) }
|
|
6343
|
-
}
|
|
6344
|
-
}
|
|
6345
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((JSRegExp?) throws -> JSArray<JSMatch>?)?)
|
|
6346
|
-
-> JSFunctionObject?
|
|
6347
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6348
|
-
}
|
|
6349
|
-
|
|
6350
|
-
public struct FunctionCell_AnyOpt_to_JSMatch {
|
|
6351
|
-
public let f: (Any?) throws -> JSMatch
|
|
6352
|
-
public static func implicit(_ value: ((Any?) throws -> JSMatch)?) -> ((Any?) throws -> JSMatch)? { value }
|
|
6353
|
-
public static func present(_ value: ((Any?) throws -> JSMatch)?) throws -> (Any?) throws -> JSMatch {
|
|
6354
|
-
guard let value else { throw jsNoObject() }
|
|
6355
|
-
return value
|
|
6356
|
-
}
|
|
6357
|
-
public static func fromScript(_ __f: Any?) -> (Any?) throws -> JSMatch {
|
|
6358
|
-
if let __t = jsFlat(__f) as? (Any?) throws -> JSMatch { return __t }
|
|
6359
|
-
let __i = JSFunctionAlias(of: __f)
|
|
6360
|
-
return jsIdentified(
|
|
6361
|
-
Self(f: { (__p0: Any?) throws -> JSMatch in
|
|
6362
|
-
return try withExtendedLifetime(__i) { () throws -> JSMatch in
|
|
6363
|
-
return try (jsCastPresent(try jsCall(__f, __p0)) as JSMatch)
|
|
6364
|
-
}
|
|
6365
|
-
}), __i
|
|
6366
|
-
).f
|
|
6367
|
-
}
|
|
6368
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Any?) throws -> JSMatch)? {
|
|
6369
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
6370
|
-
}
|
|
6371
|
-
}
|
|
6372
|
-
|
|
6373
|
-
public struct FunctionCell_JSRegExpOpt_to_JSArray_JSMatch {
|
|
6374
|
-
public let f: (JSRegExp?) throws -> JSArray<JSMatch>
|
|
6375
|
-
public static func implicit(_ value: ((JSRegExp?) throws -> JSArray<JSMatch>)?) -> (
|
|
6376
|
-
(JSRegExp?) throws -> JSArray<JSMatch>
|
|
6377
|
-
)? { value }
|
|
6378
|
-
public static func present(_ value: ((JSRegExp?) throws -> JSArray<JSMatch>)?) throws -> (JSRegExp?) throws ->
|
|
6379
|
-
JSArray<JSMatch>
|
|
6380
|
-
{
|
|
6381
|
-
guard let value else { throw jsNoObject() }
|
|
6382
|
-
return value
|
|
6383
|
-
}
|
|
6384
|
-
public static func fromScript(_ __f: Any?) -> (JSRegExp?) throws -> JSArray<JSMatch> {
|
|
6385
|
-
if let __t = jsFlat(__f) as? (JSRegExp?) throws -> JSArray<JSMatch> { return __t }
|
|
6386
|
-
let __i = JSFunctionAlias(of: __f)
|
|
6387
|
-
return jsIdentified(
|
|
6388
|
-
Self(f: { (__p0: JSRegExp?) throws -> JSArray<JSMatch> in
|
|
6389
|
-
return try withExtendedLifetime(__i) { () throws -> JSArray<JSMatch> in
|
|
6390
|
-
return try jsObjectRequired(
|
|
6391
|
-
jsArrayOrNil(
|
|
6392
|
-
try jsCall(__f, __p0), as: JSArray<JSMatch>.self, { try (jsCastPresent($0) as JSMatch) }))
|
|
6393
|
-
}
|
|
6394
|
-
}), __i
|
|
6395
|
-
).f
|
|
6396
|
-
}
|
|
6397
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((JSRegExp?) throws -> JSArray<JSMatch>)? {
|
|
6398
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
6399
|
-
}
|
|
6400
|
-
}
|
|
6401
|
-
|
|
6402
6280
|
public struct FunctionCell_String_to_JSDate {
|
|
6403
6281
|
public let f: (String) throws -> JSDate
|
|
6404
6282
|
public static func implicit(_ value: ((String) throws -> JSDate)?) -> ((String) throws -> JSDate)? { value }
|
|
@@ -4430,284 +4430,3 @@ public struct FunctionCell_to_Void_ViewOpt_to_to_Void_Opt {
|
|
|
4430
4430
|
_ name: String, _ length: Int, _ __f: ((@escaping () throws -> Void, View?) throws -> (() throws -> Void)?)?
|
|
4431
4431
|
) -> JSFunctionObject? { if let __f { return script(name, length, __f) } else { return nil } }
|
|
4432
4432
|
}
|
|
4433
|
-
|
|
4434
|
-
public struct FunctionCell_AnyOpt_JSArray_AnyOpt_to_AnyOpt {
|
|
4435
|
-
public let f: (Any?, JSArray<Any?>) throws -> Any?
|
|
4436
|
-
public static func implicit(_ value: ((Any?, JSArray<Any?>) throws -> Any?)?) -> (
|
|
4437
|
-
(Any?, JSArray<Any?>) throws -> Any?
|
|
4438
|
-
)? { value }
|
|
4439
|
-
public static func present(_ value: ((Any?, JSArray<Any?>) throws -> Any?)?) throws -> (Any?, JSArray<Any?>) throws
|
|
4440
|
-
-> Any?
|
|
4441
|
-
{
|
|
4442
|
-
guard let value else { throw jsNoObject() }
|
|
4443
|
-
return value
|
|
4444
|
-
}
|
|
4445
|
-
public static func fromScript(_ __f: Any?) -> (Any?, JSArray<Any?>) throws -> Any? {
|
|
4446
|
-
if let __t = jsFlat(__f) as? (Any?, JSRest<Any?>) throws -> Any? { return __t }
|
|
4447
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4448
|
-
return jsIdentified(
|
|
4449
|
-
Self(f: { (__p0: Any?, __p1: JSArray<Any?>) throws -> Any? in
|
|
4450
|
-
return try withExtendedLifetime(__i) { () throws -> Any? in
|
|
4451
|
-
return try jsCall(__f, spread: [__p0] + __p1.storage.map { $0 as Any? })
|
|
4452
|
-
}
|
|
4453
|
-
}), __i
|
|
4454
|
-
).f
|
|
4455
|
-
}
|
|
4456
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Any?, JSArray<Any?>) throws -> Any?)? {
|
|
4457
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4458
|
-
}
|
|
4459
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Any?, JSArray<Any?>) throws -> Any?)
|
|
4460
|
-
-> JSFunctionObject
|
|
4461
|
-
{
|
|
4462
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4463
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4464
|
-
return try __f(jsArg(__a, 0), JSArray<Any?>(__a.dropFirst(1).map { $0 }))
|
|
4465
|
-
}
|
|
4466
|
-
}
|
|
4467
|
-
}
|
|
4468
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Any?, JSArray<Any?>) throws -> Any?)?)
|
|
4469
|
-
-> JSFunctionObject?
|
|
4470
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4471
|
-
}
|
|
4472
|
-
|
|
4473
|
-
public struct FunctionCell_AnyOpt_String_to_String {
|
|
4474
|
-
public let f: (Any?, String) throws -> String
|
|
4475
|
-
public static func implicit(_ value: ((Any?, String) throws -> String)?) -> ((Any?, String) throws -> String)? {
|
|
4476
|
-
value
|
|
4477
|
-
}
|
|
4478
|
-
public static func present(_ value: ((Any?, String) throws -> String)?) throws -> (Any?, String) throws -> String {
|
|
4479
|
-
guard let value else { throw jsNoObject() }
|
|
4480
|
-
return value
|
|
4481
|
-
}
|
|
4482
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Any?, String) throws -> String)
|
|
4483
|
-
-> JSFunctionObject
|
|
4484
|
-
{
|
|
4485
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4486
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4487
|
-
return try __f(jsArg(__a, 0), (try jsConvertedString(jsArg(__a, 1))))
|
|
4488
|
-
}
|
|
4489
|
-
}
|
|
4490
|
-
}
|
|
4491
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Any?, String) throws -> String)?)
|
|
4492
|
-
-> JSFunctionObject?
|
|
4493
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4494
|
-
public static func fromScript(_ __f: Any?) -> (Any?, String) throws -> String {
|
|
4495
|
-
if let __t = jsFlat(__f) as? (Any?, String) throws -> String { return __t }
|
|
4496
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4497
|
-
return jsIdentified(
|
|
4498
|
-
Self(f: { (__p0: Any?, __p1: String) throws -> String in
|
|
4499
|
-
return try withExtendedLifetime(__i) { () throws -> String in
|
|
4500
|
-
return (try jsConvertedString(try jsCall(__f, __p0, __p1)))
|
|
4501
|
-
}
|
|
4502
|
-
}), __i
|
|
4503
|
-
).f
|
|
4504
|
-
}
|
|
4505
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Any?, String) throws -> String)? {
|
|
4506
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
|
|
4510
|
-
public struct FunctionCell_DoubleOpt_DoubleOpt_to_String {
|
|
4511
|
-
public let f: (Double?, Double?) throws -> String
|
|
4512
|
-
public static func implicit(_ value: ((Double?, Double?) throws -> String)?) -> (
|
|
4513
|
-
(Double?, Double?) throws -> String
|
|
4514
|
-
)? { value }
|
|
4515
|
-
public static func present(_ value: ((Double?, Double?) throws -> String)?) throws -> (Double?, Double?) throws ->
|
|
4516
|
-
String
|
|
4517
|
-
{
|
|
4518
|
-
guard let value else { throw jsNoObject() }
|
|
4519
|
-
return value
|
|
4520
|
-
}
|
|
4521
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Double?, Double?) throws -> String)
|
|
4522
|
-
-> JSFunctionObject
|
|
4523
|
-
{
|
|
4524
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4525
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4526
|
-
return try __f((try jsConvertedNumberOrNil(jsArg(__a, 0))), (try jsConvertedNumberOrNil(jsArg(__a, 1))))
|
|
4527
|
-
}
|
|
4528
|
-
}
|
|
4529
|
-
}
|
|
4530
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double?, Double?) throws -> String)?)
|
|
4531
|
-
-> JSFunctionObject?
|
|
4532
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4533
|
-
public static func fromScript(_ __f: Any?) -> (Double?, Double?) throws -> String {
|
|
4534
|
-
if let __t = jsFlat(__f) as? (Double?, Double?) throws -> String { return __t }
|
|
4535
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4536
|
-
return jsIdentified(
|
|
4537
|
-
Self(f: { (__p0: Double?, __p1: Double?) throws -> String in
|
|
4538
|
-
return try withExtendedLifetime(__i) { () throws -> String in
|
|
4539
|
-
return (try jsConvertedString(try jsCall(__f, __p0, __p1)))
|
|
4540
|
-
}
|
|
4541
|
-
}), __i
|
|
4542
|
-
).f
|
|
4543
|
-
}
|
|
4544
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Double?, Double?) throws -> String)? {
|
|
4545
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4546
|
-
}
|
|
4547
|
-
}
|
|
4548
|
-
|
|
4549
|
-
public struct FunctionCell_AnyOpt_DoubleOpt_to_JSArray_String_Opt {
|
|
4550
|
-
public let f: (Any?, Double?) throws -> JSArray<String>?
|
|
4551
|
-
public static func implicit(_ value: ((Any?, Double?) throws -> JSArray<String>?)?) -> (
|
|
4552
|
-
(Any?, Double?) throws -> JSArray<String>?
|
|
4553
|
-
)? { value }
|
|
4554
|
-
public static func present(_ value: ((Any?, Double?) throws -> JSArray<String>?)?) throws -> (Any?, Double?) throws
|
|
4555
|
-
-> JSArray<String>?
|
|
4556
|
-
{
|
|
4557
|
-
guard let value else { throw jsNoObject() }
|
|
4558
|
-
return value
|
|
4559
|
-
}
|
|
4560
|
-
public static func script(
|
|
4561
|
-
_ name: String, _ length: Int, _ __f: @escaping (Any?, Double?) throws -> JSArray<String>?
|
|
4562
|
-
) -> JSFunctionObject {
|
|
4563
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4564
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4565
|
-
return try __f(jsArg(__a, 0), (try jsConvertedNumberOrNil(jsArg(__a, 1))))
|
|
4566
|
-
}
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Any?, Double?) throws -> JSArray<String>?)?)
|
|
4570
|
-
-> JSFunctionObject?
|
|
4571
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4572
|
-
}
|
|
4573
|
-
|
|
4574
|
-
public struct FunctionCell_Double_DoubleOpt_to_String {
|
|
4575
|
-
public let f: (Double, Double?) throws -> String
|
|
4576
|
-
public static func implicit(_ value: ((Double, Double?) throws -> String)?) -> ((Double, Double?) throws -> String)?
|
|
4577
|
-
{ value }
|
|
4578
|
-
public static func present(_ value: ((Double, Double?) throws -> String)?) throws -> (Double, Double?) throws ->
|
|
4579
|
-
String
|
|
4580
|
-
{
|
|
4581
|
-
guard let value else { throw jsNoObject() }
|
|
4582
|
-
return value
|
|
4583
|
-
}
|
|
4584
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Double, Double?) throws -> String)
|
|
4585
|
-
-> JSFunctionObject
|
|
4586
|
-
{
|
|
4587
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4588
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4589
|
-
return try __f((try jsConvertedNumber(jsArg(__a, 0))), (try jsConvertedNumberOrNil(jsArg(__a, 1))))
|
|
4590
|
-
}
|
|
4591
|
-
}
|
|
4592
|
-
}
|
|
4593
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double, Double?) throws -> String)?)
|
|
4594
|
-
-> JSFunctionObject?
|
|
4595
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4596
|
-
public static func fromScript(_ __f: Any?) -> (Double, Double?) throws -> String {
|
|
4597
|
-
if let __t = jsFlat(__f) as? (Double, Double?) throws -> String { return __t }
|
|
4598
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4599
|
-
return jsIdentified(
|
|
4600
|
-
Self(f: { (__p0: Double, __p1: Double?) throws -> String in
|
|
4601
|
-
return try withExtendedLifetime(__i) { () throws -> String in
|
|
4602
|
-
return (try jsConvertedString(try jsCall(__f, __p0, __p1)))
|
|
4603
|
-
}
|
|
4604
|
-
}), __i
|
|
4605
|
-
).f
|
|
4606
|
-
}
|
|
4607
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Double, Double?) throws -> String)? {
|
|
4608
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4609
|
-
}
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4612
|
-
public struct FunctionCell_String_DoubleOpt_to_Bool {
|
|
4613
|
-
public let f: (String, Double?) throws -> Bool
|
|
4614
|
-
public static func implicit(_ value: ((String, Double?) throws -> Bool)?) -> ((String, Double?) throws -> Bool)? {
|
|
4615
|
-
value
|
|
4616
|
-
}
|
|
4617
|
-
public static func present(_ value: ((String, Double?) throws -> Bool)?) throws -> (String, Double?) throws -> Bool
|
|
4618
|
-
{
|
|
4619
|
-
guard let value else { throw jsNoObject() }
|
|
4620
|
-
return value
|
|
4621
|
-
}
|
|
4622
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (String, Double?) throws -> Bool)
|
|
4623
|
-
-> JSFunctionObject
|
|
4624
|
-
{
|
|
4625
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4626
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4627
|
-
return try __f((try jsConvertedString(jsArg(__a, 0))), (try jsConvertedNumberOrNil(jsArg(__a, 1))))
|
|
4628
|
-
}
|
|
4629
|
-
}
|
|
4630
|
-
}
|
|
4631
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((String, Double?) throws -> Bool)?)
|
|
4632
|
-
-> JSFunctionObject?
|
|
4633
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4634
|
-
public static func fromScript(_ __f: Any?) -> (String, Double?) throws -> Bool {
|
|
4635
|
-
if let __t = jsFlat(__f) as? (String, Double?) throws -> Bool { return __t }
|
|
4636
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4637
|
-
return jsIdentified(
|
|
4638
|
-
Self(f: { (__p0: String, __p1: Double?) throws -> Bool in
|
|
4639
|
-
return try withExtendedLifetime(__i) { () throws -> Bool in
|
|
4640
|
-
return (try jsConvertedBool(try jsCall(__f, __p0, __p1)))
|
|
4641
|
-
}
|
|
4642
|
-
}), __i
|
|
4643
|
-
).f
|
|
4644
|
-
}
|
|
4645
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((String, Double?) throws -> Bool)? {
|
|
4646
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4647
|
-
}
|
|
4648
|
-
}
|
|
4649
|
-
|
|
4650
|
-
public struct FunctionCell_Double_StringOpt_to_String {
|
|
4651
|
-
public let f: (Double, String?) throws -> String
|
|
4652
|
-
public static func implicit(_ value: ((Double, String?) throws -> String)?) -> ((Double, String?) throws -> String)?
|
|
4653
|
-
{ value }
|
|
4654
|
-
public static func present(_ value: ((Double, String?) throws -> String)?) throws -> (Double, String?) throws ->
|
|
4655
|
-
String
|
|
4656
|
-
{
|
|
4657
|
-
guard let value else { throw jsNoObject() }
|
|
4658
|
-
return value
|
|
4659
|
-
}
|
|
4660
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Double, String?) throws -> String)
|
|
4661
|
-
-> JSFunctionObject
|
|
4662
|
-
{
|
|
4663
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4664
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4665
|
-
return try __f((try jsConvertedNumber(jsArg(__a, 0))), (try jsConvertedStringOrNil(jsArg(__a, 1))))
|
|
4666
|
-
}
|
|
4667
|
-
}
|
|
4668
|
-
}
|
|
4669
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double, String?) throws -> String)?)
|
|
4670
|
-
-> JSFunctionObject?
|
|
4671
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4672
|
-
public static func fromScript(_ __f: Any?) -> (Double, String?) throws -> String {
|
|
4673
|
-
if let __t = jsFlat(__f) as? (Double, String?) throws -> String { return __t }
|
|
4674
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4675
|
-
return jsIdentified(
|
|
4676
|
-
Self(f: { (__p0: Double, __p1: String?) throws -> String in
|
|
4677
|
-
return try withExtendedLifetime(__i) { () throws -> String in
|
|
4678
|
-
return (try jsConvertedString(try jsCall(__f, __p0, __p1)))
|
|
4679
|
-
}
|
|
4680
|
-
}), __i
|
|
4681
|
-
).f
|
|
4682
|
-
}
|
|
4683
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Double, String?) throws -> String)? {
|
|
4684
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4685
|
-
}
|
|
4686
|
-
}
|
|
4687
|
-
|
|
4688
|
-
public struct FunctionCell_AnyOpt_DoubleOpt_to_JSArray_String {
|
|
4689
|
-
public let f: (Any?, Double?) throws -> JSArray<String>
|
|
4690
|
-
public static func implicit(_ value: ((Any?, Double?) throws -> JSArray<String>)?) -> (
|
|
4691
|
-
(Any?, Double?) throws -> JSArray<String>
|
|
4692
|
-
)? { value }
|
|
4693
|
-
public static func present(_ value: ((Any?, Double?) throws -> JSArray<String>)?) throws -> (Any?, Double?) throws
|
|
4694
|
-
-> JSArray<String>
|
|
4695
|
-
{
|
|
4696
|
-
guard let value else { throw jsNoObject() }
|
|
4697
|
-
return value
|
|
4698
|
-
}
|
|
4699
|
-
public static func fromScript(_ __f: Any?) -> (Any?, Double?) throws -> JSArray<String> {
|
|
4700
|
-
if let __t = jsFlat(__f) as? (Any?, Double?) throws -> JSArray<String> { return __t }
|
|
4701
|
-
let __i = JSFunctionAlias(of: __f)
|
|
4702
|
-
return jsIdentified(
|
|
4703
|
-
Self(f: { (__p0: Any?, __p1: Double?) throws -> JSArray<String> in
|
|
4704
|
-
return try withExtendedLifetime(__i) { () throws -> JSArray<String> in
|
|
4705
|
-
return try jsObjectRequired(jsArrayOrNil(try jsCall(__f, __p0, __p1), { jsLenientString($0) }))
|
|
4706
|
-
}
|
|
4707
|
-
}), __i
|
|
4708
|
-
).f
|
|
4709
|
-
}
|
|
4710
|
-
public static func fromScriptOrNil(_ __f: Any?) -> ((Any?, Double?) throws -> JSArray<String>)? {
|
|
4711
|
-
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
4712
|
-
}
|
|
4713
|
-
}
|