@nstudio/nativescript-compiler 9.2.0-alpha.11 → 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.
Files changed (62) hide show
  1. package/dist/cli/runtime.cjs +7 -1
  2. package/dist/css/css.js +30 -6
  3. package/dist/driver/compile.js +1 -0
  4. package/dist/driver/paths.js +7 -0
  5. package/dist/kotlin/access.js +1 -1
  6. package/dist/kotlin/conversion.js +17 -5
  7. package/dist/kotlin/expressions.js +8 -3
  8. package/dist/kotlin/literals.js +7 -9
  9. package/dist/kotlin/native/calls.js +84 -3
  10. package/dist/kotlin/overrides.js +7 -5
  11. package/dist/kotlin/placement.js +3 -1
  12. package/dist/kotlin/static-calls.js +6 -4
  13. package/dist/kotlin/translator.js +31 -11
  14. package/dist/kotlin/type-facts.js +10 -2
  15. package/dist/plugins/native-android.js +30 -2
  16. package/dist/program/program.js +35 -26
  17. package/dist/semantics/facts.js +28 -1
  18. package/dist/semantics/shapes.js +21 -1
  19. package/dist/swift/conversion.js +1 -1
  20. package/dist/swift/from-any.js +2 -2
  21. package/dist/swift/literals.js +4 -4
  22. package/dist/swift/modules.js +1 -1
  23. package/dist/swift/placement.js +2 -3
  24. package/dist/swift/static-calls.js +5 -3
  25. package/dist/targets/android/build.js +5 -3
  26. package/kit-android/generated/kotlin/org/nativescript/kit/application_application.kt +4 -4
  27. package/kit-android/generated/kotlin/org/nativescript/kit/image_source_index.kt +1 -1
  28. package/kit-android/generated/kotlin/org/nativescript/kit/ui_animation_animation_common.kt +7 -3
  29. package/kit-android/generated/kotlin/org/nativescript/kit/ui_animation_index.kt +3 -1
  30. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_base_index.kt +2 -4
  31. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_index.kt +5 -6
  32. package/kit-android/generated/kotlin/org/nativescript/kit/ui_dialogs_index.kt +11 -6
  33. package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_fragment_transitions.kt +1 -1
  34. package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_frame_common.kt +1 -1
  35. package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_frame_helper_for_android.kt +7 -5
  36. package/kit-android/generated/kotlin/org/nativescript/kit/ui_frame_index.kt +6 -3
  37. package/kit-android/generated/kotlin/org/nativescript/kit/ui_gestures_touch_manager.kt +1 -1
  38. package/kit-android/generated/kotlin/org/nativescript/kit/ui_layouts_flexbox_layout_index.kt +1 -1
  39. package/kit-android/generated/kotlin/org/nativescript/kit/ui_search_bar_index.kt +4 -3
  40. package/kit-android/generated/kotlin/org/nativescript/kit/ui_segmented_bar_index.kt +2 -2
  41. package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_formatted_string.kt +1 -3
  42. package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_index.kt +1 -1
  43. package/kit-android/generated/kotlin/org/nativescript/kit/ui_transition_fade_transition.kt +1 -1
  44. package/kit-android/generated/kotlin/org/nativescript/kit/ui_transition_flip_transition.kt +8 -8
  45. package/kit-android/generated/kotlin/org/nativescript/kit/utils_index.kt +1 -1
  46. package/kit-android/generated/source-lines.json +1 -1
  47. package/kit-android/gradlew.bat +94 -0
  48. package/kit-android/src/main/kotlin/org/nativescript/kit/Signals.kt +15 -2
  49. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity1.swift +2 -15
  50. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity2.swift +9 -3
  51. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity3Plus.swift +11 -7
  52. package/kit-apple/Sources/NativeScriptKit/Core/Object_callback_thisArg_once.swift +1 -1
  53. package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_index_section_view_ios_android.swift +7 -5
  54. package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_oldIndex_newIndex.swift +4 -2
  55. package/kit-apple/Sources/NativeScriptKit/Core/data.observable.index.swift +3 -3
  56. package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +6 -2
  57. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.weak-event-listener.index.swift +3 -3
  58. package/kit-apple/Sources/NativeScriptKit/Core/ui.gestures.index.ios.swift +2 -2
  59. package/kit-apple/Sources/NativeScriptKit/Core/ui.repeater.index.swift +6 -2
  60. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.formatted-string.swift +2 -1
  61. package/kit-apple/Sources/NativeScriptKit/Signals.swift +20 -2
  62. package/package.json +2 -1
@@ -224,8 +224,10 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
224
224
  const notPlugin = (pkg) => NOT_PLUGINS.test(pkg) || build.adapter.isFrameworkPackage(pkg) || build.stubbedPlugins.has(pkg);
225
225
  // A build that compiles packages from their source compiles some packages the framework's adapter otherwise shims.
226
226
  const shims = { ...SHIMS, ...rules.shims, ...(plugins ? {} : rules.fallbackShims) };
227
- const substituted = new Set(Object.values(rules.substitutions ?? {}).map((s) => s.file));
228
- const files = new Map(virtual);
227
+ const normPath = (p) => p.replace(/\\/g, '/');
228
+ const substituted = new Set(Object.values(rules.substitutions ?? {}).map((s) => normPath(s.file)));
229
+ const virtualNorm = new Set([...virtual.keys()].map(normPath));
230
+ const files = new Map([...virtual].map(([k, v]) => [normPath(k), v]));
229
231
  for (const [m, text] of Object.entries(shims))
230
232
  files.set(shimPath(m), text);
231
233
  const hasDom = appIncludesDomLib(roots[0] ?? [...virtual.keys()][0]);
@@ -260,10 +262,13 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
260
262
  // the other platform's types name what code for that platform holds (`signal<android.view.View | null>`).
261
263
  const pluginFiles = new Set();
262
264
  const extraRoots = new Set();
263
- const isSource = (name) => !name.startsWith('/__shims__/') && !name.endsWith('.d.ts') && (build.adapter.isRuntimeSource(name) || !name.includes('/node_modules/'));
264
- const isApp = (name) => isSource(name) && !pluginFiles.has(name);
265
+ const isSource = (name) => {
266
+ const n = normPath(name);
267
+ return !n.startsWith('/__shims__/') && !n.endsWith('.d.ts') && (build.adapter.isRuntimeSource(n) || !n.includes('/node_modules/'));
268
+ };
269
+ const isApp = (name) => isSource(name) && !pluginFiles.has(normPath(name));
265
270
  // The app's declarations are read for the native APIs they declare: the frameworks' own typings they reference would replace the shims.
266
- const appTypings = new Set(declarations);
271
+ const appTypings = new Set(declarations.map(normPath));
267
272
  const nativeReferences = (text, file) => text.replace(/^\/\/\/\s*<reference\s+(path|types)="([^"]*)"\s*\/>.*$/gm, (line, kind, ref) => {
268
273
  const target = resolve(dirname(file), ref);
269
274
  const pkg = /[\\/]node_modules[\\/]((?:@[^\\/]+[\\/])?[^\\/]+)/.exec(target)?.[1].replace(/\\/g, '/');
@@ -272,17 +277,18 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
272
277
  // TypeScript loads a file's `/// <reference path>` sources (a package's index referencing its operators barrel) before resolving
273
278
  // the file's imports, so a plugin's referenced source is claimed here or its imports resolve as the app's.
274
279
  const declaredExports = (name, code) => {
275
- if (!pluginFiles.has(name))
280
+ if (!pluginFiles.has(normPath(name)))
276
281
  return code;
277
282
  for (const [, ref] of code.matchAll(/^\/\/\/\s*<reference\s+path="([^"]*\.tsx?)"\s*\/>/gm))
278
283
  if (!ref.endsWith('.d.ts'))
279
- pluginFiles.add(resolve(dirname(name), ref));
284
+ pluginFiles.add(normPath(resolve(dirname(name), ref)));
280
285
  return pluginDeclaredExports(code, name, platform);
281
286
  };
282
- const appRoot = plugins?.options?.app ? resolve(plugins.options.app) : null;
283
- const rootSet = new Set(roots);
287
+ const appRoot = plugins?.options?.app ? normPath(resolve(plugins.options.app)) : null;
288
+ const rootSet = new Set(roots.map(normPath));
284
289
  host.getSourceFile = (name, version, onError) => {
285
- const text = files.get(name) ?? (isSource(name) && existsSync(name) ? readFileSync(name, 'utf8') : appTypings.has(name) ? nativeReferences(readFileSync(name, 'utf8'), name) : undefined);
290
+ const key = normPath(name);
291
+ const text = files.get(key) ?? (isSource(key) && existsSync(name) ? readFileSync(name, 'utf8') : appTypings.has(key) ? nativeReferences(readFileSync(name, 'utf8'), name) : undefined);
286
292
  if (text === undefined) {
287
293
  // A package's own TypeScript (or pure-JS ESM) source.
288
294
  if (!/\.(tsx?|m?js)$/.test(name) || name.endsWith('.d.ts') || !existsSync(name))
@@ -294,15 +300,15 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
294
300
  }
295
301
  return ts.createSourceFile(name, desugarClassMixins(desugarConstructorFactories(declaredExports(name, raw), name), name), version, true);
296
302
  }
297
- const transformed = !name.startsWith('/__shims__/') && !name.startsWith('/__raw__/') && !name.startsWith('/__vite__/') && !name.endsWith('.d.ts') ? vitePlugins.transform(text, name) : text;
298
- const expanded = !name.startsWith('/__shims__/') && !name.endsWith('.d.ts') ? desugarDefaultExport(expandImportMetaGlob(transformed, name, appRoot), name) : transformed;
299
- const code = /\.tsx?$/.test(name) && !name.endsWith('.d.ts') ? desugarClassMixins(desugarConstructorFactories(declaredExports(name, expanded), name), name) : expanded;
300
- return ts.createSourceFile(name, isSource(name) ? foldPlatform(code, name, platform, modules, build.defines) : code, version, true);
303
+ const transformed = !key.startsWith('/__shims__/') && !key.startsWith('/__raw__/') && !key.startsWith('/__vite__/') && !key.endsWith('.d.ts') ? vitePlugins.transform(text, name) : text;
304
+ const expanded = !key.startsWith('/__shims__/') && !key.endsWith('.d.ts') ? desugarDefaultExport(expandImportMetaGlob(transformed, name, appRoot), name) : transformed;
305
+ const code = /\.tsx?$/.test(key) && !key.endsWith('.d.ts') ? desugarClassMixins(desugarConstructorFactories(declaredExports(name, expanded), name), name) : expanded;
306
+ return ts.createSourceFile(name, isSource(key) ? foldPlatform(code, name, platform, modules, build.defines) : code, version, true);
301
307
  };
302
308
  const fileExists = host.fileExists.bind(host);
303
- host.fileExists = (name) => files.has(name) || fileExists(name);
309
+ host.fileExists = (name) => files.has(normPath(name)) || fileExists(name);
304
310
  const readFile = host.readFile.bind(host);
305
- host.readFile = (name) => files.get(name) ?? readFile(name);
311
+ host.readFile = (name) => files.get(normPath(name)) ?? readFile(name);
306
312
  const resolutions = new Map();
307
313
  // A plugin's augmentations of other packages (`declare module '@nativescript/firebase-core'`), which its source keeps in
308
314
  // the declarations beside it (`index.d.ts`), apply as its published typings apply them.
@@ -382,8 +388,9 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
382
388
  const m = aliasTarget ?? lit.text;
383
389
  const substitution = rules.substitutions && Object.hasOwn(rules.substitutions, m) && !replacements[m] ? rules.substitutions[m] : undefined;
384
390
  if (substitution && (plugins || !substitution.sourcesOnly)) {
385
- pluginFiles.add(substitution.file);
386
- return { resolvedModule: { resolvedFileName: substitution.file, extension: ts.Extension.Ts } };
391
+ const subFile = normPath(substitution.file);
392
+ pluginFiles.add(subFile);
393
+ return { resolvedModule: { resolvedFileName: subFile, extension: ts.Extension.Ts } };
387
394
  }
388
395
  if (substitution?.otherwise)
389
396
  return { resolvedModule: { resolvedFileName: shimPath(substitution.otherwise), extension: ts.Extension.Dts } };
@@ -391,33 +398,35 @@ export function createProgram(roots, virtual, platform = 'ios', modulesDir, plug
391
398
  return { resolvedModule: { resolvedFileName: shimPath(m), extension: ts.Extension.Dts } };
392
399
  const stub = !m.startsWith('.') && !isAbsolute(m) ? build.pluginStubModules.get(packageOf(m)) : undefined;
393
400
  if (stub) {
394
- pluginFiles.add(stub);
395
- return { resolvedModule: { resolvedFileName: stub, extension: ts.Extension.Ts } };
401
+ const stubFile = normPath(stub);
402
+ pluginFiles.add(stubFile);
403
+ return { resolvedModule: { resolvedFileName: stubFile, extension: ts.Extension.Ts } };
396
404
  }
397
405
  // The build's own glue imports app modules by absolute path (`__elements.release.ts`).
398
406
  if (m.startsWith('.') || (isAbsolute(m) && !m.startsWith('/__shims__/'))) {
399
- const base = resolve(dirname(containing), m);
407
+ const base = normPath(resolve(dirname(containing), m));
400
408
  const stem = base.replace(/\.m?js$/, '');
409
+ const containingNorm = normPath(containing);
401
410
  // A platform's own file first, as NativeScript's bundler resolves `./x` to `x.ios.ts`.
402
411
  // A platform file importing its own module's name (`import type { HingeListener } from './hinge-tracker'` in
403
412
  // hinge-tracker.ios.ts) means the module's declarations: `x.d.ts`, else the platforms' shared `x.ts`.
404
413
  const typeOnly = (ts.isImportDeclaration(lit.parent) && !!lit.parent.importClause?.isTypeOnly) || (ts.isExportDeclaration(lit.parent) && lit.parent.isTypeOnly);
405
414
  // A type-only import is TypeScript's, which reads `x.d.ts` beside the platforms' files; only the bundler picks `x.ios.ts`.
406
- const own = containing === `${stem}.${platform}.ts` || (typeOnly && existsSync(stem + '.d.ts'));
415
+ const own = containingNorm === `${stem}.${platform}.ts` || (typeOnly && existsSync(stem + '.d.ts'));
407
416
  const direct = /\.(tsx?|d\.ts)$/.test(base) ? [base] : [];
408
- const jsFallback = pluginFiles.has(containing) ? [...(/\.m?js$/.test(base) ? [base] : []), stem + '.js', stem + '.mjs', stem + '/index.js', stem + '/index.mjs'] : [];
417
+ const jsFallback = pluginFiles.has(containingNorm) ? [...(/\.m?js$/.test(base) ? [base] : []), stem + '.js', stem + '.mjs', stem + '/index.js', stem + '/index.mjs'] : [];
409
418
  for (const candidate of own ? [...direct, stem + '.d.ts', stem + '.ts'] : [...direct, `${stem}.${platform}.ts`, stem + '.ts', stem + '.tsx', `${stem}/index.${platform}.ts`, stem + '/index.ts', ...jsFallback]) {
410
419
  if (files.has(candidate) || existsSync(candidate)) {
411
420
  if (candidate.endsWith('.d.ts'))
412
421
  return { resolvedModule: { resolvedFileName: candidate, extension: ts.Extension.Dts } };
413
422
  // A component file replaced by a compiled `.release.ts` virtual file must resolve to the virtual file everywhere so classes with private members stay nominally identical.
414
423
  const released = candidate.endsWith('.ts') && !candidate.endsWith('.release.ts') ? candidate.replace(/\.ts$/, '.release.ts') : undefined;
415
- if (released && virtual.has(released) && containing !== released)
424
+ if (released && virtualNorm.has(released) && containingNorm !== released)
416
425
  return { resolvedModule: { resolvedFileName: released, extension: ts.Extension.Ts } };
417
426
  // A plugin's own modules, a substitution's file, or a monorepo workspace library outside the app folder
418
427
  // (not already compiled as an app/component root) are compiled through closed-world reachability.
419
- const isCompiledRoot = rootSet.has(candidate) || virtual.has(candidate) || virtual.has(candidate.replace(/\.ts$/, '.release.ts'));
420
- if (!isCompiledRoot && (pluginFiles.has(containing) || substituted.has(candidate) || (aliasTarget && appRoot && !candidate.startsWith(appRoot + sep))))
428
+ const isCompiledRoot = rootSet.has(candidate) || virtualNorm.has(candidate) || virtualNorm.has(candidate.replace(/\.ts$/, '.release.ts'));
429
+ if (!isCompiledRoot && (pluginFiles.has(containingNorm) || substituted.has(candidate) || (aliasTarget && appRoot && !candidate.startsWith(appRoot + '/'))))
421
430
  pluginFiles.add(candidate);
422
431
  const extension = candidate.endsWith('.tsx') ? ts.Extension.Tsx : candidate.endsWith('.mjs') ? ts.Extension.Mjs : candidate.endsWith('.js') ? ts.Extension.Js : ts.Extension.Ts;
423
432
  return { resolvedModule: { resolvedFileName: candidate, extension } };
@@ -4,7 +4,7 @@
4
4
  import ts from 'typescript';
5
5
  import { definitelyAssignedFields, isArguments, classesHeldUntyped } from "./lang.js";
6
6
  import { baseMethod, declaringMethod, literalClassOf, programBase, rootMethod, shapesClassOf } from "./classes.js";
7
- import { expandoRootsOf, instanceKeysOf } from "./shapes.js";
7
+ import { expandoRootsOf, instanceKeysOf, isShapeInterfaceDecl } from "./shapes.js";
8
8
  import { hasModifier, resolveSymbol } from "./ast.js";
9
9
  import { isStatic } from "./throws.js";
10
10
  import { assignedMembers } from "./sharing.js";
@@ -38,6 +38,33 @@ export class ProgramFacts {
38
38
  familyMap = null;
39
39
  protoKeys = null;
40
40
  tdzSet = null;
41
+ ifaceDecls = null;
42
+ ifaceNamesByTop = new WeakMap();
43
+ /** All interface / object-shape type alias declarations across the program's source files. */
44
+ interfaceDecls() {
45
+ if (this.ifaceDecls)
46
+ return this.ifaceDecls;
47
+ const out = [];
48
+ const visit = (n) => {
49
+ if (isShapeInterfaceDecl(n))
50
+ out.push(n);
51
+ ts.forEachChild(n, visit);
52
+ };
53
+ for (const f of this.files)
54
+ visit(f);
55
+ return (this.ifaceDecls = out);
56
+ }
57
+ /** Whether `name` is an interface registered in `interfaces` or declared anywhere in `this.files` under `owner`'s top-level naming. */
58
+ hasInterface(owner, interfaces, topName, name) {
59
+ if (interfaces.has(name))
60
+ return true;
61
+ let set = this.ifaceNamesByTop.get(owner);
62
+ if (!set) {
63
+ set = new Set(this.interfaceDecls().map((n) => topName(n, n.name.text)));
64
+ this.ifaceNamesByTop.set(owner, set);
65
+ }
66
+ return set.has(name);
67
+ }
41
68
  checker;
42
69
  files;
43
70
  scope;
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import { heldOf, isPrimitive, presentOf, spelledType } from "./types.js";
2
+ import { heldOf, isPrimitive, isUntyped, presentOf, spelledType } from "./types.js";
3
3
  import { admitsUndefined, alwaysThrows, containsThis, hasStatic, jsKeyOrder, literalKey, onlyUndefined } from "./lang.js";
4
4
  import { programBase } from "./classes.js";
5
5
  import { assignsClassFields } from "./class-plan.js";
@@ -39,6 +39,18 @@ export function inPlanOrder(plan, fields) {
39
39
  }
40
40
  /** The type holds nil as its value: `T?`, `Any?`. */
41
41
  export const holdsNil = (h) => h === 'optional' || h === 'any';
42
+ /** An interface or object-shape type alias declared in program source (collected upfront for order-independent checks). */
43
+ export const isShapeInterfaceDecl = (n) => !n.getSourceFile().isDeclarationFile && (ts.isInterfaceDeclaration(n) || (ts.isTypeAliasDeclaration(n) && (ts.isTypeLiteralNode(n.type) || ts.isIntersectionTypeNode(n.type))));
44
+ /** Property access inside `Array.isArray(x)` when `x` reads a property off an object shape / interface view. */
45
+ export function shapeArrayGuardAccess(arg, isShape, typeOf) {
46
+ const a0 = arg ? ts.skipParentheses(arg) : undefined;
47
+ if (!a0 || !ts.isPropertyAccessExpression(a0))
48
+ return null;
49
+ const recvType = typeOf(a0.expression);
50
+ if (!isShape(recvType.replace(/[?!]$/, '')))
51
+ return null;
52
+ return { prop: a0, optional: !!a0.questionDotToken || recvType.endsWith('?') };
53
+ }
42
54
  /** The spelling ends in `?`, a function's result's included. */
43
55
  export const spelledOptional = (h) => holdsNil(h) || h === 'optional-result';
44
56
  /** The type holds nil, implicitly unwrapped or not. */
@@ -658,3 +670,11 @@ function runsCode(n, deep = true) {
658
670
  visit(n);
659
671
  return found;
660
672
  }
673
+ /** Whether spreading elements of `from` into an array of `to` requires elementwise mapping (untyped source or distinct structural shapes). */
674
+ export function spreadElementNeedsMap(from, to, isShape, mapUntyped) {
675
+ if (from === to)
676
+ return false;
677
+ if (mapUntyped && isUntyped(spelledType(from)))
678
+ return true;
679
+ return !isUntyped(spelledType(to)) && isShape(to.replace(/\?$/, '')) && isShape(from.replace(/\?$/, ''));
680
+ }
@@ -299,7 +299,7 @@ export const conversionMethods = {
299
299
  if (isUntyped(spelledType(from)))
300
300
  return this.fromAny(code, to);
301
301
  // An event's data read as the object type a handler declares (`({ window }: { window: NativeWindow })`).
302
- if (from === 'EventData' && (this.interfaces.has(to.replace(/\?$/, '')) || !!this.shapes.named(to.replace(/\?$/, ''))))
302
+ if (from === 'EventData' && (this.facts.hasInterface(this, this.interfaces, (d, s) => this.topName(d, s), to.replace(/\?$/, '')) || !!this.shapes.named(to.replace(/\?$/, ''))))
303
303
  return this.fromAny(code, to);
304
304
  const f = functionParts(unwrapFunction(from, false));
305
305
  const g = functionParts(unwrapFunction(to, false));
@@ -253,12 +253,12 @@ export const fromAnyMethods = {
253
253
  if (whole)
254
254
  return this.unboxFunction(code, whole);
255
255
  const base = type.replace(/\?$/, '');
256
- if (this.protocols.has(base) && this.interfaces.has(base)) {
256
+ if (this.protocols.has(base) && this.facts.hasInterface(this, this.interfaces, (d, s) => this.topName(d, s), base)) {
257
257
  this.used.add(base);
258
258
  // An interface classes implement: an object conforming to it as it is, any other read by its keys.
259
259
  return type.endsWith('?') ? `${RT.jsUnlessNullish}(${code}, { (${RT.jsFlat}($0) as? ${base}) ?? ${base}Object(jsObject: $0) })` : `{ (__o: Any?) -> ${base} in (${RT.jsFlat}(__o) as? ${base}) ?? ${base}Object(jsObject: __o) }(${code})`;
260
260
  }
261
- if (this.interfaces.has(base) || !!this.shapes.named(base) || (!this.library && this.core.viewable(base))) {
261
+ if (this.facts.hasInterface(this, this.interfaces, (d, s) => this.topName(d, s), base) || !!this.shapes.named(base) || (!this.library && this.core.viewable(base))) {
262
262
  this.used.add(base);
263
263
  // An object of the interface's class already is the object read (a receiver `call` passes); any other is read by its keys.
264
264
  return type.endsWith('?') ? `${RT.jsUnlessNullish}(${code}, { (${RT.jsFlat}($0) as? ${base}) ?? ${this.viewOf(base, '$0')} })` : `{ (__o: Any?) -> ${base} in (${RT.jsFlat}(__o) as? ${base}) ?? ${this.viewOf(base, '__o')} }(${code})`;
@@ -3,7 +3,7 @@ import ts from 'typescript';
3
3
  import { functionParts, ident, identPath, initOrder, isNullish, isOptional, label, optionalType, splitTopLevel, swiftString, withoutThenables, spell, RT } from "./syntax.js";
4
4
  import { assertedOperand, evolvingElementContext, intersectionAliasMembers, isTypeParameterType, literalKey, openSpreadType, spreadOperand, unquoted } from "../semantics/lang.js";
5
5
  import { place } from "../semantics/placement.js";
6
- import { holdsNil, literalNotes, signatureField, shapePlanOfLiteral, spelledOptional, resultShapeNamed } from "../semantics/shapes.js";
6
+ import { holdsNil, literalNotes, signatureField, shapePlanOfLiteral, spelledOptional, spreadElementNeedsMap, resultShapeNamed } from "../semantics/shapes.js";
7
7
  import { isCoreDeclaration } from "../program/core-facts.js";
8
8
  import { hasModifier, thisNodes, tupleSpreadTypes, withoutDefault } from "../semantics/ast.js";
9
9
  import { programSymbolKey } from "../program/stable-names.js";
@@ -88,9 +88,9 @@ export const literalsMethods = {
88
88
  parts.push(`[${run.join(', ')}]`);
89
89
  run = [];
90
90
  }
91
- // The spread's elements as this array's (`[name, ...untyped]` into a `string[]`).
92
- const from = this.elementTypeOf(x.expression);
93
- parts.push(from !== el && isUntyped(spelledType(from)) ? `Array(${this.iterable(x.expression)}).map { ${this.fromAny('$0', el)} }` : `Array(${this.iterable(x.expression)})`);
91
+ // The spread's elements as this array's (`[name, ...untyped]` into a `string[]`, or `[...derived]` into a base shape array).
92
+ const needsMap = spreadElementNeedsMap(this.elementTypeOf(x.expression), el, (n) => this.isObjectShape(n), true);
93
+ parts.push(needsMap ? `Array(${this.iterable(x.expression)}).map { ${this.fromAny('$0', el)} }` : `Array(${this.iterable(x.expression)})`);
94
94
  }
95
95
  else if (ts.isOmittedExpression(x))
96
96
  throw this.error(x, 'an array hole', 'array-hole');
@@ -581,7 +581,7 @@ export const modulesMethods = {
581
581
  return { shape: (n) => this.isObjectShape(n), extends: (a, b) => !!this.classNamed(a) && this.sourceExtends(a, b) };
582
582
  },
583
583
  isObjectShape(name) {
584
- return (this.interfaces.has(name) && !this.protocols.has(name)) || !!this.shapes.named(name) || (!this.library && this.core.viewable(name));
584
+ return (this.facts.hasInterface(this, this.interfaces, (d, s) => this.topName(d, s), name) && !this.protocols.has(name)) || !!this.shapes.named(name) || (!this.library && this.core.viewable(name));
585
585
  },
586
586
  /** An interface's members with those of the interfaces it extends (`StageFold extends Rect`), its own first. */
587
587
  interfaceMembers(decl) {
@@ -178,7 +178,7 @@ export const placementMethods = {
178
178
  if (!shape) {
179
179
  // An interface's object class, whose fields are its property signatures.
180
180
  const d = this.checker.getSymbolAtLocation(e.name)?.valueDeclaration;
181
- if (!d || !ts.isPropertySignature(d) || !ts.isInterfaceDeclaration(d.parent) || d.parent.name.text !== held || !this.interfaces.has(held) || this.protocols.has(held))
181
+ if (!d || !ts.isPropertySignature(d) || !ts.isInterfaceDeclaration(d.parent) || d.parent.name.text !== held || !this.facts.hasInterface(this, this.interfaces, (x, s) => this.topName(x, s), held) || this.protocols.has(held))
182
182
  return null;
183
183
  const t = this.typeOf(d);
184
184
  return (d.questionToken || holdsNil(heldOf(spelledType(t)))) && heldOf(spelledType(t)) !== 'any' ? e.name.text : null;
@@ -703,8 +703,7 @@ export const placementMethods = {
703
703
  if (/^\(.*\)$/.test(source) && !functionParts(source) && /^JSArray<.*>[?!]?$/.test(target))
704
704
  return this.convert(this.expr(e), source, target);
705
705
  // An array literal is made of the slot's element type already.
706
- const literal = ts.isArrayLiteralExpression(bare) && !bare.elements.some(ts.isSpreadElement);
707
- if (literal && /^JSArray<.+>[?!]?$/.test(source) && /^JSArray<.+>[?!]?$/.test(target) && ['elements', 'view'].includes(structural(parseNativeType(source), parseNativeType(target), this.structuralFacts())?.step ?? ''))
706
+ if (ts.isArrayLiteralExpression(bare) && /^JSArray<.+>[?!]?$/.test(source) && /^JSArray<.+>[?!]?$/.test(target) && ['elements', 'view'].includes(structural(parseNativeType(source), parseNativeType(target), this.structuralFacts())?.step ?? ''))
708
707
  return this.expr(e);
709
708
  if (/^JSArray<\w+>[?!]?$/.test(source) && /^JSArray<\w+>[?!]?$/.test(target) && source.replace(/[?!]$/, '') !== target.replace(/[?!]$/, ''))
710
709
  return this.convert(this.expr(e), source, target);
@@ -4,7 +4,7 @@ import { TYPED_ARRAYS } from "../semantics/globals.js";
4
4
  import { ident, isFunctionType, optionalType, swiftString, RT } from "./syntax.js";
5
5
  import { literalKey, statementLevel, undefinedLiteral } from "../semantics/lang.js";
6
6
  import { arrayFromLengthInit } from "../semantics/ast.js";
7
- import { assignsArrayIntoObject, definesDuringConstruction, restrictsField, definedField } from "../semantics/shapes.js";
7
+ import { assignsArrayIntoObject, definesDuringConstruction, restrictsField, definedField, shapeArrayGuardAccess } from "../semantics/shapes.js";
8
8
  import { CONSOLE } from "../semantics/apis/console.js";
9
9
  import { staticFunction } from "../semantics/apis/statics.js";
10
10
  import { runtimeCall } from "../semantics/apis/api.js";
@@ -111,8 +111,10 @@ export const staticCallsMethods = {
111
111
  break;
112
112
  }
113
113
  case 'Array':
114
- if (method === 'isArray')
115
- return `JSArray<Any?>.isArray(${this.restArgument(e, arg(0), 'Any?')})`;
114
+ if (method === 'isArray') {
115
+ const g = !this.library ? shapeArrayGuardAccess(arg(0), (t) => this.isObjectShape(t), (x) => this.typeOf(x)) : null;
116
+ return `JSArray<Any?>.isArray(${g ? `${this.expr(g.prop.expression)}${g.optional ? '?' : ''}[jsKey: ${swiftString(g.prop.name.text)}]` : this.restArgument(e, arg(0), 'Any?')})`;
117
+ }
116
118
  if (method === 'from' && e.arguments.length === 1)
117
119
  return `${T()}.from(${this.iterable(arg(0))})`;
118
120
  if (method === 'from' && (e.arguments.length === 2 || e.arguments.length === 3) && ts.isObjectLiteralExpression(arg(0))) {
@@ -21,7 +21,7 @@ import { formatKotlin } from "../../kotlin/ktfmt.js";
21
21
  import { moduleThreads, THREAD_ANNOTATIONS } from "../../semantics/threading.js";
22
22
  import { androidManifest, copyAndroidAppFiles, copyAndroidFonts, pluginManifests } from "./resources.js";
23
23
  import { appResourcesDir, uncaughtErrorSwitches } from "../resources.js";
24
- import { KIT_ANDROID, PACKAGE } from "../../driver/paths.js";
24
+ import { gradleWrapper, KIT_ANDROID, PACKAGE } from "../../driver/paths.js";
25
25
  import { OVERLAY_FILE, XML_FREE_OVERLAY } from "../../kit/overlay.js";
26
26
  import { byName } from "../../program/order.js";
27
27
  import { programClassName } from "../../semantics/top-names.js";
@@ -93,7 +93,8 @@ export async function writeAndroid(b) {
93
93
  plainFields: !!b.translatorHooks?.plainFields,
94
94
  appMembersByName: !!b.xml && !b.xmlMemberKeys,
95
95
  pluginRoots: (b.plugins ?? []).map((p) => p.root + '/'),
96
- workerScripts: new Map((b.workers ?? []).map((f) => [f, relative(b.app, f)])),
96
+ workerScripts: new Map((b.workers ?? []).map((f) => [f.replace(/\\/g, '/'), relative(b.app, f).replace(/\\/g, '/')])),
97
+ resolveAlias: b.aliased ?? null,
97
98
  moduleThread: (file) => threads.get(file),
98
99
  moduleKey: lazy.size ? (file) => relative(b.app, file) : undefined,
99
100
  });
@@ -465,7 +466,8 @@ ${overlays.map((m) => ` variant.sources.manifests.addStaticManifestFile($
465
466
  const k = b.keyStore;
466
467
  const signing = k ? [`-Pandroid.injected.signing.store.file=${resolve(k.path)}`, `-Pandroid.injected.signing.store.password=${k.password}`, `-Pandroid.injected.signing.key.alias=${k.alias}`, `-Pandroid.injected.signing.key.password=${k.aliasPassword}`] : [];
467
468
  // Kotlin's errors point into the generated files: printed with the TypeScript lines they came from.
468
- const gradle = spawnSync(join(kit, 'gradlew'), ['-p', b.out, ':assembleRelease', ...(b.bundle ? [':bundleRelease'] : []), ...signing, '--quiet'], { stdio: ['inherit', 'pipe', 'pipe'], encoding: 'utf8', maxBuffer: 1 << 30 });
469
+ const gw = gradleWrapper(['-p', b.out, ':assembleRelease', ...(b.bundle ? [':bundleRelease'] : []), ...signing, '--quiet'], kit);
470
+ const gradle = spawnSync(gw.command, gw.args, { stdio: ['inherit', 'pipe', 'pipe'], encoding: 'utf8', maxBuffer: 1 << 30 });
469
471
  process.stdout.write(mapKotlinDiagnostics(gradle.stdout ?? '', b.out));
470
472
  process.stderr.write(mapKotlinDiagnostics(gradle.stderr ?? '', b.out));
471
473
  if (gradle.status !== 0)
@@ -399,16 +399,16 @@ open class AndroidApplication : ApplicationCommon {
399
399
  BroadcastReceiverImpl(onReceiveCallback)
400
400
  }
401
401
  if (Core_utils_constants.SDK_VERSION >= 26.0) {
402
- ((context ?: jsCannotRead("registerReceiver")).registerReceiver(
402
+ (context ?: jsCannotRead("registerReceiver")).registerReceiver(
403
403
  receiver,
404
404
  IntentFilter(intentFilter),
405
405
  flags.toLong().toInt(),
406
- ) ?: jsObjectRequired())
406
+ )
407
407
  } else {
408
- ((context ?: jsCannotRead("registerReceiver")).registerReceiver(
408
+ (context ?: jsCannotRead("registerReceiver")).registerReceiver(
409
409
  receiver,
410
410
  IntentFilter(intentFilter),
411
- ) ?: jsObjectRequired())
411
+ )
412
412
  }
413
413
  val receiverInfo: Any? =
414
414
  jsObjectOf(
@@ -563,7 +563,7 @@ open class ImageSource : JSExpando, JSKeysMade {
563
563
  val bitmapDrawable: BitmapDrawable? =
564
564
  ((res ?: jsCannotRead("getDrawable")).getDrawable(
565
565
  identifier.toLong().toInt()
566
- ) as BitmapDrawable)
566
+ ) as? BitmapDrawable)
567
567
  if (
568
568
  (jsTruthy(bitmapDrawable) &&
569
569
  jsTruthy(
@@ -192,7 +192,9 @@ abstract class AnimationBase : JSExpando, JSKeysMade {
192
192
  val r: Any? =
193
193
  jsCallMethod(_then, "apply", promise, __arguments)
194
194
  (_this ?: jsCannotRead("fixupAnimationPromise"))
195
- .fixupAnimationPromise(jsUnlessNullish(r) { jsPromiseOf<Unit>(it) })
195
+ .fixupAnimationPromise(
196
+ jsUnlessNullish(r) { jsPromiseOf<Unit>(it) { Unit } }
197
+ )
196
198
  return r
197
199
  }
198
200
  JSMethod { _, __a -> __f(jsArrayOf<Any?>(*__a)) }
@@ -209,7 +211,9 @@ abstract class AnimationBase : JSExpando, JSKeysMade {
209
211
  val r: Any? =
210
212
  jsCallMethod(_catch, "apply", promise, __arguments)
211
213
  (_this ?: jsCannotRead("fixupAnimationPromise"))
212
- .fixupAnimationPromise(jsUnlessNullish(r) { jsPromiseOf<Unit>(it) })
214
+ .fixupAnimationPromise(
215
+ jsUnlessNullish(r) { jsPromiseOf<Unit>(it) { Unit } }
216
+ )
213
217
  return r
214
218
  }
215
219
  JSMethod { _, __a -> __f(jsArrayOf<Any?>(*__a)) }
@@ -262,7 +266,7 @@ abstract class AnimationBase : JSExpando, JSKeysMade {
262
266
  "fixupAnimationPromise" ->
263
267
  jsFunction { __a ->
264
268
  this.fixupAnimationPromise(
265
- jsUnlessNullish(__a.getOrNull(0)) { jsPromiseOf<Unit>(it) }
269
+ jsUnlessNullish(__a.getOrNull(0)) { jsPromiseOf<Unit>(it) { Unit } }
266
270
  )
267
271
  null
268
272
  }
@@ -1176,7 +1176,9 @@ open class Animation : AnimationBase {
1176
1176
  jsConvertedNumberOrNull(jsGet(propertyAnimation, "iterations")) != null &&
1177
1177
  (animators.element(i) is ValueAnimator)
1178
1178
  ) {
1179
- (((animators.element(i) ?: jsObjectRequired()) as ValueAnimator))
1179
+ (jsUnchecked<ValueAnimator>(
1180
+ ((animators.element(i) ?: jsObjectRequired()) as? ValueAnimator)
1181
+ ))
1180
1182
  .setRepeatCount(
1181
1183
  Core_ui_animation_index.getAndroidRepeatCount(
1182
1184
  (jsConvertedNumberOrNull(jsGet(propertyAnimation, "iterations"))
@@ -891,14 +891,12 @@ abstract class ViewBase : Observable, JSStringConvertible {
891
891
 
892
892
  /** Returns the child view with the specified id. */
893
893
  open fun getViewById(id: String?): Any? {
894
- return (Core_ui_core_view_base_index.getViewById(this, id)
895
- ?: jsObjectRequired())
894
+ return Core_ui_core_view_base_index.getViewById(this, id)
896
895
  }
897
896
 
898
897
  /** Returns the child view with the specified domId. */
899
898
  open fun getViewByDomId(domId: Double): Any? {
900
- return (Core_ui_core_view_base_index.getViewByDomId(this, domId)
901
- ?: jsObjectRequired())
899
+ return Core_ui_core_view_base_index.getViewByDomId(this, domId)
902
900
  }
903
901
 
904
902
  /** @unstable Ensures a dom-node for this view. */
@@ -1164,7 +1164,7 @@ open class View : ViewCommon {
1164
1164
  open fun clearInsetListener() {
1165
1165
  this.insetListenerIsSet = false
1166
1166
  val nativeView: Any? =
1167
- (jsCast(this.nativeViewProtected, android_view_View::class.java) ?: jsObjectRequired())
1167
+ jsCast(this.nativeViewProtected, android_view_View::class.java)
1168
1168
  if (jsTruthy(jsGetOptional(nativeView, "setInsetListener"))) {
1169
1169
  jsCallMethod(nativeView, "setInsetListener", jsNull)
1170
1170
  }
@@ -1208,7 +1208,7 @@ open class View : ViewCommon {
1208
1208
  .getChildFragmentManager()
1209
1209
  break
1210
1210
  }
1211
- val fragments: Any? = (view ?: jsObjectRequired())
1211
+ val fragments: Any? = view
1212
1212
  if (jsTruthy(jsGet(fragments, "_hasFragments"))) {
1213
1213
  if (frameOrTabViewItemFound) {
1214
1214
  manager =
@@ -1232,7 +1232,7 @@ open class View : ViewCommon {
1232
1232
 
1233
1233
  open fun __symbol_androidOverflowEdgeProperty_setNative(value: String?) {
1234
1234
  val nativeView: Any? =
1235
- (jsCast(this.nativeViewProtected, android_view_View::class.java) ?: jsObjectRequired())
1235
+ jsCast(this.nativeViewProtected, android_view_View::class.java)
1236
1236
  if (
1237
1237
  jsTypeof(value) != "string" ||
1238
1238
  jsStrictEquals(nativeView, jsNull) ||
@@ -2846,8 +2846,7 @@ open class View : ViewCommon {
2846
2846
  (fun() {
2847
2847
  var backgroundDrawable: Drawable? = backgroundDrawable
2848
2848
  val nativeView: Any? =
2849
- (jsCast(this.nativeViewProtected, android_view_View::class.java)
2850
- ?: jsObjectRequired())
2849
+ jsCast(this.nativeViewProtected, android_view_View::class.java)
2851
2850
  if (onlyColor) {
2852
2851
  val backgroundColor: Double =
2853
2852
  ((background ?: jsCannotRead("color")).color ?: jsCannotRead("android")).android
@@ -2989,7 +2988,7 @@ open class View : ViewCommon {
2989
2988
 
2990
2989
  open fun onBackgroundOrBorderPropertyChanged() {
2991
2990
  val nativeView: Any? =
2992
- (jsCast(this.nativeViewProtected, android_view_View::class.java) ?: jsObjectRequired())
2991
+ jsCast(this.nativeViewProtected, android_view_View::class.java)
2993
2992
  if (!jsTruthy(nativeView)) {
2994
2993
  return
2995
2994
  }
@@ -6,6 +6,7 @@ import android.content.Context
6
6
  import android.content.DialogInterface
7
7
  import android.graphics.Typeface
8
8
  import android.text.InputType
9
+ import android.view.View as android_view_View
9
10
  import android.widget.Button as android_widget_Button
10
11
  import android.widget.EditText
11
12
  import android.widget.LinearLayout
@@ -59,8 +60,9 @@ object Core_ui_dialogs_index {
59
60
  .toDouble()
60
61
  if (jsTruthy(textViewId)) {
61
62
  val tv: android_widget_TextView? =
62
- ((dlg ?: jsCannotRead("findViewById")).findViewById(textViewId.toLong().toInt())
63
- as android_widget_TextView)
63
+ ((dlg ?: jsCannotRead("findViewById")).findViewById<android_view_View>(
64
+ textViewId.toLong().toInt()
65
+ ) as? android_widget_TextView)
64
66
  if (jsTruthy(tv)) {
65
67
  (tv ?: jsCannotRead("setTextColor")).setTextColor(
66
68
  (labelColor ?: jsCannotRead("android")).android.toLong().toInt()
@@ -75,9 +77,9 @@ object Core_ui_dialogs_index {
75
77
  .toDouble()
76
78
  if (jsTruthy(messageTextViewId)) {
77
79
  val messageTextView: android_widget_TextView? =
78
- ((dlg ?: jsCannotRead("findViewById")).findViewById(
80
+ ((dlg ?: jsCannotRead("findViewById")).findViewById<android_view_View>(
79
81
  messageTextViewId.toLong().toInt()
80
- ) as android_widget_TextView)
82
+ ) as? android_widget_TextView)
81
83
  if (jsTruthy(messageTextView)) {
82
84
  (messageTextView ?: jsCannotRead("setTextColor")).setTextColor(
83
85
  (labelColor ?: jsCannotRead("android")).android.toLong().toInt()
@@ -101,8 +103,11 @@ object Core_ui_dialogs_index {
101
103
  .getIdentifier("android:id/button" + js(i), null, null)
102
104
  .toDouble()
103
105
  buttons[i] =
104
- ((dlg ?: jsCannotRead("findViewById")).findViewById(id.toLong().toInt())
105
- as android_widget_Button)
106
+ jsUnchecked<android_widget_Button>(
107
+ ((dlg ?: jsCannotRead("findViewById")).findViewById<android_view_View>(
108
+ id.toLong().toInt()
109
+ ) as? android_widget_Button)
110
+ )
106
111
  i += 1.0
107
112
  }
108
113
  buttons.forEach({ button: android_widget_Button? ->
@@ -1518,7 +1518,7 @@ object Core_ui_frame_fragment_transitions {
1518
1518
  jsSet(values, js(0.0), 0.0)
1519
1519
  jsSet(values, js(1.0), 1.0)
1520
1520
  val animator: Animator? =
1521
- (ObjectAnimator.ofFloat((null as Any?), "alpha", *(values as FloatArray)) as Animator)
1521
+ (ObjectAnimator.ofFloat((null as Any?), "alpha", *(values as FloatArray)) as? Animator)
1522
1522
  (animator ?: jsCannotRead("setDuration")).setDuration(duration.toLong())
1523
1523
  jsSet(objectAnimators, js(0.0), animator)
1524
1524
  animatorSet.playTogether(*(jsAs<Array<Animator>>(objectAnimators)))
@@ -783,7 +783,7 @@ open class FrameBase : CustomLayoutView {
783
783
  if (
784
784
  (jsTruthy(this.currentPage) &&
785
785
  Core_ui_core_view_view_common.viewMatchesModuleContext(
786
- jsCast((this.currentPage ?: jsObjectRequired()), ViewCommon::class.java),
786
+ jsCast(this.currentPage, ViewCommon::class.java),
787
787
  context,
788
788
  jsArrayOf<String>("markup", "script"),
789
789
  ))
@@ -183,11 +183,13 @@ open class FragmentCallbacksImplementation : JSExpando, JSKeysMade {
183
183
  }
184
184
  val savedState: Any? = jsGet(entry, "viewSavedState")
185
185
  if (jsTruthy(savedState)) {
186
- (((jsCast(
187
- (page ?: jsCannotRead("nativeViewProtected")).nativeViewProtected,
188
- org_nativescript_widgets_GridLayout::class.java,
189
- ) ?: jsObjectRequired())
190
- as android_view_View))
186
+ (jsUnchecked<android_view_View>(
187
+ ((jsCast(
188
+ (page ?: jsCannotRead("nativeViewProtected")).nativeViewProtected,
189
+ org_nativescript_widgets_GridLayout::class.java,
190
+ ) ?: jsObjectRequired())
191
+ as? android_view_View)
192
+ ))
191
193
  .restoreHierarchyState(jsAs<SparseArray<Parcelable>?>(savedState))
192
194
  jsSet(entry, "viewSavedState", jsNull)
193
195
  }
@@ -95,8 +95,9 @@ open class Frame : FrameBase {
95
95
  (jsCastCarried(
96
96
  jsCallOptional(
97
97
  jsJavaGet(
98
- ((((activity ?: jsObjectRequired()) as FragmentActivity))
99
- ?: jsObjectRequired()),
98
+ ((jsUnchecked<FragmentActivity>(
99
+ ((activity ?: jsObjectRequired()) as? FragmentActivity)
100
+ )) ?: jsObjectRequired()),
100
101
  "getLifecycle",
101
102
  )
102
103
  ),
@@ -1864,7 +1865,9 @@ object Core_ui_frame_index {
1864
1865
  JSWeakRef<AppCompatActivity>(jsWeakRefTarget(activity)),
1865
1866
  )
1866
1867
  jsSet((activity ?: jsObjectRequired()), "_onBackPressed", true)
1867
- (((activity ?: jsObjectRequired()) as ComponentActivity))
1868
+ (jsUnchecked<ComponentActivity>(
1869
+ ((activity ?: jsObjectRequired()) as? ComponentActivity)
1870
+ ))
1868
1871
  .onBackPressedDispatcher
1869
1872
  .addCallback(
1870
1873
  (activity ?: jsObjectRequired()),
@@ -266,7 +266,7 @@ object Core_ui_gestures_touch_manager {
266
266
  lateinit var touchState: JSSymbol
267
267
 
268
268
  fun getTouchState(view: View?): Any? {
269
- val holder: Any? = (view ?: jsObjectRequired())
269
+ val holder: Any? = view
270
270
  if (!jsTruthy(jsGet(holder, Core_ui_gestures_touch_manager.touchState.key))) {
271
271
  jsSet(holder, Core_ui_gestures_touch_manager.touchState.key, jsObjectOf())
272
272
  }