@nstudio/nativescript-compiler 9.2.0-alpha.10 → 9.2.0-alpha.12
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/cli/runtime.cjs +7 -1
- package/dist/css/css.js +30 -6
- package/dist/driver/cli.js +2 -0
- package/dist/driver/compile.js +23 -10
- package/dist/driver/paths.js +7 -0
- package/dist/driver/unimplemented.js +15 -0
- package/dist/kotlin/access.js +23 -5
- 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/conversion.js +17 -5
- 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/expressions.js +8 -3
- package/dist/kotlin/functions.js +13 -4
- package/dist/kotlin/global-calls.js +11 -0
- package/dist/kotlin/literals.js +58 -14
- package/dist/kotlin/names.js +2 -2
- package/dist/kotlin/native/api.js +9 -1
- package/dist/kotlin/native/calls.js +84 -3
- 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/overrides.js +7 -5
- package/dist/kotlin/placement.js +3 -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 +10 -7
- package/dist/kotlin/translator.js +31 -11
- package/dist/kotlin/type-facts.js +10 -2
- package/dist/kotlin/types.js +6 -6
- package/dist/plugins/native-android.js +37 -5
- 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 +239 -38
- 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/facts.js +28 -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/shapes.js +21 -1
- 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/conversion.js +1 -1
- package/dist/swift/core-api.js +9 -12
- package/dist/swift/from-any.js +2 -2
- 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 +57 -10
- package/dist/swift/modules.js +1 -1
- 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 +44 -4
- 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 +13 -6
- package/dist/swift/types.js +9 -9
- package/dist/targets/android/build.js +18 -12
- 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/application_application.kt +4 -4
- package/kit-android/generated/kotlin/org/nativescript/kit/image_source_index.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_animation_animation_common.kt +7 -3
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_animation_index.kt +3 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_base_index.kt +2 -4
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_index.kt +5 -6
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_view_common.kt +1 -3
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_dialogs_index.kt +11 -6
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_fragment_transitions.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_frame_common.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_frame_helper_for_android.kt +7 -5
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_index.kt +6 -3
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_gestures_touch_manager.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_layouts_flexbox_layout_index.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_search_bar_index.kt +4 -3
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_segmented_bar_index.kt +2 -2
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_formatted_string.kt +1 -3
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_index.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_transition_fade_transition.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_transition_flip_transition.kt +8 -8
- package/kit-android/generated/kotlin/org/nativescript/kit/utils_index.kt +1 -1
- package/kit-android/generated/source-lines.json +1 -1
- package/kit-android/gradlew.bat +94 -0
- package/kit-android/src/fromcore/kotlin/org/nativescript/kit/CoreBridge.kt +67 -1
- package/kit-android/src/main/kotlin/org/nativescript/kit/Signals.kt +15 -2
- 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 +26 -161
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity2.swift +9 -284
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity3Plus.swift +11 -7
- package/kit-apple/Sources/NativeScriptKit/Core/Object_callback_thisArg_once.swift +1 -1
- package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_index_section_view_ios_android.swift +7 -5
- package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_oldIndex_newIndex.swift +4 -2
- 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/data.observable.index.swift +3 -3
- 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 +40 -246
- 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.core.weak-event-listener.index.swift +3 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.frame.index.ios.swift +4 -4
- package/kit-apple/Sources/NativeScriptKit/Core/ui.gestures.index.ios.swift +2 -2
- 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 +10 -6
- 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/ui.text-base.formatted-string.swift +2 -1
- 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/kit-apple/Sources/NativeScriptKit/Signals.swift +20 -2
- package/package.json +2 -1
- package/kit-apple/Sources/NativeScriptKit/Core/Object_toString_charAt_charCodeAt_concat_indexOf_lastIndexOf_and_44_more_fc25df.swift +0 -481
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
@rem SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
@rem
|
|
18
|
+
|
|
19
|
+
@if "%DEBUG%"=="" @echo off
|
|
20
|
+
@rem ##########################################################################
|
|
21
|
+
@rem
|
|
22
|
+
@rem Gradle startup script for Windows
|
|
23
|
+
@rem
|
|
24
|
+
@rem ##########################################################################
|
|
25
|
+
|
|
26
|
+
@rem Set local scope for the variables with windows NT shell
|
|
27
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
28
|
+
|
|
29
|
+
set DIRNAME=%~dp0
|
|
30
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
31
|
+
@rem This is normally unused
|
|
32
|
+
set APP_BASE_NAME=%~n0
|
|
33
|
+
set APP_HOME=%DIRNAME%
|
|
34
|
+
|
|
35
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
36
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
37
|
+
|
|
38
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
39
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
40
|
+
|
|
41
|
+
@rem Find java.exe
|
|
42
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
43
|
+
|
|
44
|
+
set JAVA_EXE=java.exe
|
|
45
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
46
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
47
|
+
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
50
|
+
echo. 1>&2
|
|
51
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
52
|
+
echo location of your Java installation. 1>&2
|
|
53
|
+
|
|
54
|
+
goto fail
|
|
55
|
+
|
|
56
|
+
:findJavaFromJavaHome
|
|
57
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
58
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
59
|
+
|
|
60
|
+
if exist "%JAVA_EXE%" goto execute
|
|
61
|
+
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
64
|
+
echo. 1>&2
|
|
65
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
66
|
+
echo location of your Java installation. 1>&2
|
|
67
|
+
|
|
68
|
+
goto fail
|
|
69
|
+
|
|
70
|
+
:execute
|
|
71
|
+
@rem Setup the command line
|
|
72
|
+
|
|
73
|
+
set CLASSPATH=
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@rem Execute Gradle
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
|
78
|
+
|
|
79
|
+
:end
|
|
80
|
+
@rem End local scope for the variables with windows NT shell
|
|
81
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
82
|
+
|
|
83
|
+
:fail
|
|
84
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
85
|
+
rem the _cmd.exe /c_ return code!
|
|
86
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
87
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
88
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
89
|
+
exit /b %EXIT_CODE%
|
|
90
|
+
|
|
91
|
+
:mainEnd
|
|
92
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
93
|
+
|
|
94
|
+
:omega
|
|
@@ -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)
|
|
@@ -433,7 +433,7 @@ interface MemoReader {
|
|
|
433
433
|
* next read. A result `same` as the kept one (Object.is) keeps the kept one and its version. Nothing it read holds it: a
|
|
434
434
|
* reader asks for its value.
|
|
435
435
|
*/
|
|
436
|
-
class Memo<T>(private val compute: () -> T, private val same: (T, T) -> Boolean = ::jsSame) : Versioned, MemoReader {
|
|
436
|
+
class Memo<T>(private val compute: () -> T, private val same: (T, T) -> Boolean = ::jsSame) : Versioned, MemoReader, JSDynamic {
|
|
437
437
|
private var cached: Result<T>? = null
|
|
438
438
|
private val sources = mutableListOf<Pair<Versioned, Int>>()
|
|
439
439
|
override var version = 0
|
|
@@ -493,6 +493,11 @@ class Memo<T>(private val compute: () -> T, private val same: (T, T) -> Boolean
|
|
|
493
493
|
|
|
494
494
|
/** A function's local `computed()` (`val total by Memo(…)`): each read of the local is the memo's value. */
|
|
495
495
|
operator fun getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): T = value
|
|
496
|
+
|
|
497
|
+
override val jsKeys: List<String> get() = listOf("value")
|
|
498
|
+
override val jsClassName: String? get() = null
|
|
499
|
+
override fun jsGet(key: String): Any? = if (key == "value") value else null
|
|
500
|
+
override fun jsSet(key: String, value: Any?) {}
|
|
496
501
|
}
|
|
497
502
|
|
|
498
503
|
/**
|
|
@@ -500,7 +505,7 @@ class Memo<T>(private val compute: () -> T, private val same: (T, T) -> Boolean
|
|
|
500
505
|
* (`equals`, by default `==`: Object.is for numbers and strings, identity for
|
|
501
506
|
* the runtime's objects) is ignored.
|
|
502
507
|
*/
|
|
503
|
-
class Signal<T>(private var stored: T, private val equals: ((T, T) -> Boolean)? = null) : Versioned {
|
|
508
|
+
class Signal<T>(private var stored: T, private val equals: ((T, T) -> Boolean)? = null) : Versioned, JSDynamic {
|
|
504
509
|
private val subscribers = LinkedHashSet<Subscriber>()
|
|
505
510
|
override var version = 0
|
|
506
511
|
private set
|
|
@@ -625,6 +630,14 @@ class Signal<T>(private var stored: T, private val equals: ((T, T) -> Boolean)?
|
|
|
625
630
|
link?.let { for (s in it.sources.toList()) s.first.subscribe(effect) }
|
|
626
631
|
}
|
|
627
632
|
|
|
633
|
+
override val jsKeys: List<String> get() = listOf("value")
|
|
634
|
+
override val jsClassName: String? get() = null
|
|
635
|
+
override fun jsGet(key: String): Any? = if (key == "value") value else null
|
|
636
|
+
@Suppress("UNCHECKED_CAST")
|
|
637
|
+
override fun jsSet(key: String, value: Any?) {
|
|
638
|
+
if (key == "value") this.value = (if (value === JSNull) null else value) as T
|
|
639
|
+
}
|
|
640
|
+
|
|
628
641
|
/**
|
|
629
642
|
* A `linkedSignal`'s computation, run as a memo's is: on the first read or write, and on each one after a value it
|
|
630
643
|
* read has a new version. [compute] is handed whether the signal holds a value (computed or written; not on the
|
|
@@ -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)
|
|
@@ -570,7 +570,7 @@ public struct FunctionCell_EventDataOpt_to_Void {
|
|
|
570
570
|
{
|
|
571
571
|
jsBoxedFunction(Self(f: __f)) {
|
|
572
572
|
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
573
|
-
try __f((jsArg(__a, 0) as? EventData))
|
|
573
|
+
try __f(jsUnlessNullish(jsArg(__a, 0), { (jsFlat($0) as? EventData) ?? EventData(jsObject: $0) }))
|
|
574
574
|
return nil
|
|
575
575
|
}
|
|
576
576
|
}
|
|
@@ -590,19 +590,6 @@ public struct FunctionCell_EventDataOpt_to_Void {
|
|
|
590
590
|
public static func fromScriptOrNil(_ __f: Any?) -> ((EventData?) throws -> Void)? {
|
|
591
591
|
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
592
592
|
}
|
|
593
|
-
public static func lenientScript(_ name: String, _ length: Int, _ __f: @escaping (EventData?) throws -> Void)
|
|
594
|
-
-> JSFunctionObject
|
|
595
|
-
{
|
|
596
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
597
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
598
|
-
try __f(jsUnlessNullish(jsArg(__a, 0), { (jsFlat($0) as? EventData) ?? EventData(jsObject: $0) }))
|
|
599
|
-
return nil
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
public static func lenientScriptOrNil(_ name: String, _ length: Int, _ __f: ((EventData?) throws -> Void)?)
|
|
604
|
-
-> JSFunctionObject?
|
|
605
|
-
{ if let __f { return lenientScript(name, length, __f) } else { return nil } }
|
|
606
593
|
public static func adapting(_ __h: @escaping (Any?) throws -> Void) -> (EventData?) throws -> Void {
|
|
607
594
|
let __i = JSFunctionAlias(cell: FunctionCell_AnyOpt_to_Void(f: __h))
|
|
608
595
|
return jsIdentified(
|
|
@@ -1174,20 +1161,6 @@ public struct FunctionCell_Double_to_String {
|
|
|
1174
1161
|
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double) throws -> String)?)
|
|
1175
1162
|
-> JSFunctionObject?
|
|
1176
1163
|
{ 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
1164
|
}
|
|
1192
1165
|
|
|
1193
1166
|
public struct FunctionCell_ViewOpt_to_UIViewControllerOpt {
|
|
@@ -4305,20 +4278,6 @@ public struct FunctionCell_Double_to_Double {
|
|
|
4305
4278
|
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double) throws -> Double)?)
|
|
4306
4279
|
-> JSFunctionObject?
|
|
4307
4280
|
{ 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
4281
|
}
|
|
4323
4282
|
|
|
4324
4283
|
public struct FunctionCell_TokenTypeOpt_to_Bool {
|
|
@@ -5975,6 +5934,18 @@ public struct FunctionCell_String_to_JSSymbol {
|
|
|
5975
5934
|
guard let value else { throw jsNoObject() }
|
|
5976
5935
|
return value
|
|
5977
5936
|
}
|
|
5937
|
+
public static func script(_ name: String, _ length: Int, _ __f: @escaping (String) throws -> JSSymbol)
|
|
5938
|
+
-> JSFunctionObject
|
|
5939
|
+
{
|
|
5940
|
+
jsBoxedFunction(Self(f: __f)) {
|
|
5941
|
+
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
5942
|
+
return try __f((try jsConvertedString(jsArg(__a, 0))))
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((String) throws -> JSSymbol)?)
|
|
5947
|
+
-> JSFunctionObject?
|
|
5948
|
+
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
5978
5949
|
public static func fromScript(_ __f: Any?) -> (String) throws -> JSSymbol {
|
|
5979
5950
|
if let __t = jsFlat(__f) as? (String) throws -> JSSymbol { return __t }
|
|
5980
5951
|
let __i = JSFunctionAlias(of: __f)
|
|
@@ -5989,18 +5960,6 @@ public struct FunctionCell_String_to_JSSymbol {
|
|
|
5989
5960
|
public static func fromScriptOrNil(_ __f: Any?) -> ((String) throws -> JSSymbol)? {
|
|
5990
5961
|
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
5991
5962
|
}
|
|
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
5963
|
}
|
|
6005
5964
|
|
|
6006
5965
|
public struct FunctionCell_JSSymbol_to_String {
|
|
@@ -6010,6 +5969,18 @@ public struct FunctionCell_JSSymbol_to_String {
|
|
|
6010
5969
|
guard let value else { throw jsNoObject() }
|
|
6011
5970
|
return value
|
|
6012
5971
|
}
|
|
5972
|
+
public static func script(_ name: String, _ length: Int, _ __f: @escaping (JSSymbol) throws -> String)
|
|
5973
|
+
-> JSFunctionObject
|
|
5974
|
+
{
|
|
5975
|
+
jsBoxedFunction(Self(f: __f)) {
|
|
5976
|
+
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
5977
|
+
return try __f((try jsChecked(jsArg(__a, 0), JSSymbol.self)))
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
}
|
|
5981
|
+
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((JSSymbol) throws -> String)?)
|
|
5982
|
+
-> JSFunctionObject?
|
|
5983
|
+
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
6013
5984
|
public static func fromScript(_ __f: Any?) -> (JSSymbol) throws -> String {
|
|
6014
5985
|
if let __t = jsFlat(__f) as? (JSSymbol) throws -> String { return __t }
|
|
6015
5986
|
let __i = JSFunctionAlias(of: __f)
|
|
@@ -6024,18 +5995,6 @@ public struct FunctionCell_JSSymbol_to_String {
|
|
|
6024
5995
|
public static func fromScriptOrNil(_ __f: Any?) -> ((JSSymbol) throws -> String)? {
|
|
6025
5996
|
jsIsNullish(__f) ? nil : fromScript(__f)
|
|
6026
5997
|
}
|
|
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
5998
|
}
|
|
6040
5999
|
|
|
6041
6000
|
public struct FunctionCell_Object_x_yOpt_to_JSArray_AnyOpt_Opt {
|
|
@@ -6305,100 +6264,6 @@ public struct FunctionCell_String_to_JSArray_InheritedCssPropertyOpt_AnyOpt {
|
|
|
6305
6264
|
}
|
|
6306
6265
|
}
|
|
6307
6266
|
|
|
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
6267
|
public struct FunctionCell_String_to_JSDate {
|
|
6403
6268
|
public let f: (String) throws -> JSDate
|
|
6404
6269
|
public static func implicit(_ value: ((String) throws -> JSDate)?) -> ((String) throws -> JSDate)? { value }
|
|
@@ -6480,7 +6345,7 @@ public struct FunctionCell_ListViewBaseOpt_to_Void {
|
|
|
6480
6345
|
{
|
|
6481
6346
|
jsBoxedFunction(Self(f: __f)) {
|
|
6482
6347
|
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
6483
|
-
try __f((
|
|
6348
|
+
try __f(jsUnlessNullish(jsArg(__a, 0), { (jsFlat($0) as? ListViewBase) ?? ListViewBase(jsObject: $0) }))
|
|
6484
6349
|
return nil
|
|
6485
6350
|
}
|
|
6486
6351
|
}
|