@nstudio/nativescript-compiler 9.2.0-alpha.18 → 9.2.0-alpha.19

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 (70) hide show
  1. package/config.js +1 -0
  2. package/dist/kotlin/arguments.js +6 -0
  3. package/dist/kotlin/overrides.js +1 -1
  4. package/dist/semantics/conversion.js +9 -1
  5. package/dist/semantics/runtime.js +1 -0
  6. package/dist/semantics/signals.js +1 -1
  7. package/dist/semantics/throws.js +1 -1
  8. package/dist/swift/arguments.js +14 -9
  9. package/dist/swift/assignment.js +6 -1
  10. package/dist/swift/calls.js +7 -2
  11. package/dist/swift/class-methods.js +2 -1
  12. package/dist/swift/library.js +2 -2
  13. package/dist/swift/method-values.js +2 -1
  14. package/dist/swift/names.js +4 -4
  15. package/dist/swift/native/calls.js +9 -3
  16. package/dist/swift/placement.js +18 -3
  17. package/dist/swift/static-calls.js +1 -1
  18. package/dist/swift/syntax.js +1 -1
  19. package/dist/swift/types.js +2 -2
  20. package/kit-android/src/fromcore/kotlin/org/nativescript/kit/NativeScriptApplication.kt +9 -0
  21. package/kit-apple/Overlays/xml-free/Core/ui.builder.index.swift +6 -2
  22. package/kit-apple/Sources/NativeScriptKit/Core/data.observable-array.index.swift +1 -1
  23. package/kit-apple/Sources/NativeScriptKit/Core/file-system.file-system-access.ios.swift +7 -7
  24. package/kit-apple/Sources/NativeScriptKit/Core/file-system.index.swift +10 -10
  25. package/kit-apple/Sources/NativeScriptKit/Core/http.http-request-internal.index.ios.swift +1 -1
  26. package/kit-apple/Sources/NativeScriptKit/Core/http.index.swift +3 -3
  27. package/kit-apple/Sources/NativeScriptKit/Core/image-source.index.ios.swift +2 -2
  28. package/kit-apple/Sources/NativeScriptKit/Core/js-libs.easysax.easysax.swift +4 -22
  29. package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +2 -1
  30. package/kit-apple/Sources/NativeScriptKit/Core/ui.action-bar.index.ios.swift +33 -21
  31. package/kit-apple/Sources/NativeScriptKit/Core/ui.activity-indicator.index.ios.swift +12 -6
  32. package/kit-apple/Sources/NativeScriptKit/Core/ui.animation.keyframe-animation.swift +1 -1
  33. package/kit-apple/Sources/NativeScriptKit/Core/ui.builder.index.swift +6 -2
  34. package/kit-apple/Sources/NativeScriptKit/Core/ui.button.index.ios.swift +14 -13
  35. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.properties.index.swift +8 -7
  36. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.index.ios.swift +79 -59
  37. package/kit-apple/Sources/NativeScriptKit/Core/ui.date-picker.index.ios.swift +17 -16
  38. package/kit-apple/Sources/NativeScriptKit/Core/ui.dialogs.index.ios.swift +2 -2
  39. package/kit-apple/Sources/NativeScriptKit/Core/ui.editable-text-base.index.ios.swift +27 -18
  40. package/kit-apple/Sources/NativeScriptKit/Core/ui.html-view.index.ios.swift +9 -9
  41. package/kit-apple/Sources/NativeScriptKit/Core/ui.image.index.ios.swift +6 -6
  42. package/kit-apple/Sources/NativeScriptKit/Core/ui.label.index.ios.swift +8 -8
  43. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.layout-base.ios.swift +4 -3
  44. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.liquid-glass-container.index.ios.swift +1 -1
  45. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.liquid-glass.index.ios.swift +1 -1
  46. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.root-layout.index.ios.swift +2 -2
  47. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.root-layout.root-layout-common.swift +9 -9
  48. package/kit-apple/Sources/NativeScriptKit/Core/ui.list-picker.index.ios.swift +9 -6
  49. package/kit-apple/Sources/NativeScriptKit/Core/ui.list-view.index.ios.swift +38 -20
  50. package/kit-apple/Sources/NativeScriptKit/Core/ui.page.index.ios.swift +2 -2
  51. package/kit-apple/Sources/NativeScriptKit/Core/ui.progress.index.ios.swift +12 -10
  52. package/kit-apple/Sources/NativeScriptKit/Core/ui.scroll-view.index.ios.swift +18 -9
  53. package/kit-apple/Sources/NativeScriptKit/Core/ui.search-bar.index.ios.swift +28 -18
  54. package/kit-apple/Sources/NativeScriptKit/Core/ui.segmented-bar.index.ios.swift +19 -12
  55. package/kit-apple/Sources/NativeScriptKit/Core/ui.slider.index.ios.swift +14 -12
  56. package/kit-apple/Sources/NativeScriptKit/Core/ui.split-view.index.ios.swift +14 -9
  57. package/kit-apple/Sources/NativeScriptKit/Core/ui.switch.index.ios.swift +12 -10
  58. package/kit-apple/Sources/NativeScriptKit/Core/ui.tab-view.index.ios.swift +36 -20
  59. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.formatted-string.swift +2 -2
  60. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.index.ios.swift +25 -22
  61. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.text-base-common.swift +2 -3
  62. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-field.index.ios.swift +21 -14
  63. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-view.index.ios.swift +33 -21
  64. package/kit-apple/Sources/NativeScriptKit/Core/ui.time-picker.index.ios.swift +22 -18
  65. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.shared-transition-helper.ios.swift +15 -15
  66. package/kit-apple/Sources/NativeScriptKit/Core/ui.web-view.index.ios.swift +1 -1
  67. package/kit-apple/Sources/NativeScriptKit/Core/ui.web-view.web-view-common.swift +2 -2
  68. package/kit-apple/Sources/NativeScriptKit/Core/utils.index.ios.swift +2 -2
  69. package/kit-apple/Sources/NativeScriptKit/Runtime/Native.swift +2 -1
  70. package/package.json +5 -3
package/config.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -17,6 +17,10 @@ export const argumentsMethods = {
17
17
  if (decl && this.states.nullishHeld(decl))
18
18
  return argumentSlot(this.placement, nullishType(this.type(this.checker.getTypeOfSymbolAtLocation(p, e), e)), decl, at, { nullish: true });
19
19
  let pt = decl && this.states.nullish().held.has(decl) ? 'Any?' : this.heldElements(decl && ts.isParameter(decl) ? decl : e, this.type(this.checker.getTypeOfSymbolAtLocation(p, e), e));
20
+ // An overloaded declared function held as a Kotlin function value (`cancelAnimationFrame`) takes its Kotlin type's parameter.
21
+ const calleeParam = !appDeclared && ts.isCallExpression(e) ? functionTypeParts(this.typeOf(e.expression).replace(/^\((.*)\)\?$/, '$1'))?.params[k] : undefined;
22
+ if (calleeParam && !calleeParam.startsWith('JSArray<'))
23
+ pt = calleeParam;
20
24
  // A generic implementation's parameter is not instantiated by an overload's call: the overload's, as this call instantiates it.
21
25
  const implTypes = impl && impl !== sig?.getDeclaration() ? (impl.typeParameters?.map((t) => t.name.text) ?? []) : [];
22
26
  const resolved = sig?.getParameters()[k];
@@ -332,6 +336,8 @@ export const argumentsMethods = {
332
336
  const decl = params[k + i].valueDeclaration;
333
337
  if (s.constantDefault && isNullable(el.type))
334
338
  out.push(`(${this.convert(el.code, el.type, optionalType(s.target))} ?: ${this.coerce(decl.initializer, s.target)})`);
339
+ else if (el.type === optionalType(s.target) && ['Double', 'String', 'Boolean'].includes(s.target))
340
+ out.push(`(${el.code} ?: ${s.target === 'Double' ? 'Double.NaN' : s.target === 'String' ? '"undefined"' : 'false'})`);
335
341
  else if (isNullable(el.type) && !isNullable(s.target) && !isUntyped(spelledType(s.target)) && !isUntyped(spelledType(el.type)))
336
342
  return null;
337
343
  else
@@ -472,7 +472,7 @@ export const overridesMethods = {
472
472
  if (!decls.length)
473
473
  return this.pluginFiles.has(e.getSourceFile().fileName) && !isArguments(e, this.checker) && !['undefined', 'NaN', 'Infinity'].includes(e.text);
474
474
  // The animation-frame functions held as values: kit-android's runtime has none.
475
- if (['requestAnimationFrame', 'cancelAnimationFrame'].includes(e.text) && decls.every((d) => d.getSourceFile().fileName === '/__shims__/globals.d.ts') && !(ts.isCallExpression(e.parent) && e.parent.expression === e))
475
+ if (['requestAnimationFrame', 'cancelAnimationFrame'].includes(e.text) && decls.every((d) => d.getSourceFile().isDeclarationFile) && !(ts.isCallExpression(e.parent) && e.parent.expression === e))
476
476
  return true;
477
477
  return isDomGlobalDeclaration(e.text, decls);
478
478
  },
@@ -2,6 +2,7 @@ import ts from 'typescript';
2
2
  import { isUntyped, parseNativeType } from "./types.js";
3
3
  import { TRACING, traced } from "./decision-trace.js";
4
4
  import { lossOf } from "./losses.js";
5
+ import { declaresThis } from "./ast.js";
5
6
  /**
6
7
  * The rule a placement of a value the backend holds as `from` into `to` follows, the first
7
8
  * that matches; `claimed` is the type the checker gives the value. Pure: the backends spell each rule.
@@ -241,7 +242,14 @@ export function erasesTypeParameter(p, ledger) {
241
242
  if (structural && p.constraint && (ts.isTypeLiteralNode(p.constraint) || (ts.isIntersectionTypeNode(p.constraint) && p.constraint.types.some(ts.isTypeLiteralNode))))
242
243
  return true;
243
244
  const named = new RegExp(`\\b${p.name.text}\\b`);
244
- return !fn.parameters.some((q) => q.type && named.test(q.type.getText()) && !(structural && functionShaped(q.type) && (!functionTypeNode(q.type) || keepsIdentity('function', q))));
245
+ return !fn.parameters.some((q) => {
246
+ if (!q.type || !named.test(q.type.getText()))
247
+ return false;
248
+ if (!structural || !functionShaped(q.type))
249
+ return true;
250
+ const ftn = functionTypeNode(q.type);
251
+ return !!ftn && !declaresThis(ftn) && !keepsIdentity('function', q);
252
+ });
245
253
  }
246
254
  /** A function type, with null or undefined. */
247
255
  function functionTypeNode(t) {
@@ -338,6 +338,7 @@ const SWIFT_ONLY = [
338
338
  'jsNativeNumber',
339
339
  'jsNativeObject',
340
340
  'jsNativeResult',
341
+ 'jsNativeSet',
341
342
  'jsNativeString',
342
343
  'jsNativeStruct',
343
344
  'jsNativeStructField',
@@ -166,7 +166,7 @@ export function propSignal(e, checker, framework) {
166
166
  }
167
167
  /** Whether `n` declares or references an untyped variable initialized from a read of a signal holding null (`const card = this.morning()`). */
168
168
  export function isGivenNullSignalValue(n, resolve, isNullSignalRead) {
169
- const d = (ts.isVariableDeclaration(n.parent) && n.parent.name === n ? n.parent : ts.isIdentifier(n) ? resolve(n)?.valueDeclaration : undefined);
169
+ const d = (n.parent && ts.isVariableDeclaration(n.parent) && n.parent.name === n ? n.parent : ts.isIdentifier(n) ? resolve(n)?.valueDeclaration : undefined);
170
170
  if (!d || !ts.isVariableDeclaration(d) || d.type || !d.initializer)
171
171
  return false;
172
172
  return isNullSignalRead(d.initializer);
@@ -534,7 +534,7 @@ export class Throws {
534
534
  // A library function held (`export const parse = parseFloat`, `const { isArray } = Array`): Swift holds it as a function value, which throws.
535
535
  if (ts.isCallExpression(call) && holder && !holder.getSourceFile().isDeclarationFile && ((init && (ts.isIdentifier(init) || ts.isPropertyAccessExpression(init)) && (['parseInt', 'parseFloat'].includes(init.getText()) || !!signature?.getSourceFile().isDeclarationFile)) || (ts.isBindingElement(holder) && !!signature?.getSourceFile().isDeclarationFile)))
536
536
  return true;
537
- if ((ts.isCallExpression(call) || ts.isNewExpression(call)) && holder && !holder.getSourceFile().isDeclarationFile && !signature?.getSourceFile().isDeclarationFile && (ts.isVariableDeclaration(holder) || ts.isBindingElement(holder) || ts.isParameter(holder) || ts.isPropertyDeclaration(holder) || ts.isPropertySignature(holder) || ts.isPropertyAssignment(holder) || ts.isGetAccessorDeclaration(holder) || ts.isShorthandPropertyAssignment(holder)))
537
+ if ((ts.isCallExpression(call) || ts.isNewExpression(call)) && holder && !holder.getSourceFile().isDeclarationFile && (!signature?.getSourceFile().isDeclarationFile || ts.isFunctionTypeNode(signature) || (ts.isCallSignatureDeclaration(signature) && isLibFile(signature.getSourceFile()))) && (ts.isVariableDeclaration(holder) || ts.isBindingElement(holder) || ts.isParameter(holder) || ts.isPropertyDeclaration(holder) || ts.isPropertySignature(holder) || ts.isPropertyAssignment(holder) || ts.isGetAccessorDeclaration(holder) || ts.isShorthandPropertyAssignment(holder)))
538
538
  return true;
539
539
  // A local holding a library function (`const dip = Utils.layout.toDeviceIndependentPixels`), or one a call made (`view.dispose.bind(view)`): a Swift function value, which throws.
540
540
  if (ts.isCallExpression(call) && holder && ts.isVariableDeclaration(holder) && !holder.getSourceFile().isDeclarationFile && holder.initializer && (ts.isPropertyAccessExpression(skipParens(holder.initializer)) || ts.isCallExpression(skipParens(holder.initializer))))
@@ -7,17 +7,20 @@ import { isStatic } from "../semantics/throws.js";
7
7
  import { isUntyped, spelledType } from "../semantics/types.js";
8
8
  import { untypedGeneric } from "../semantics/spelled.js";
9
9
  import { baseMethod } from "../semantics/classes.js";
10
+ import { isCoreDeclaration } from "../program/core-facts.js";
10
11
  export const argumentsMethods = {
12
+ /** Whether `decl` is a parameter whose declared type names a type parameter Swift erased. */
13
+ erasedParam(decl) {
14
+ return ((!!decl && ts.isParameter(decl) && ts.isClassLike(decl.parent.parent) && !!decl.parent.parent.typeParameters?.length && this.erasesGenerics(decl.parent.parent)) ||
15
+ (!!decl && ts.isParameter(decl) && ts.isMethodSignature(decl.parent) && this.erasingProtocol(decl.parent)) ||
16
+ (!!decl && ts.isParameter(decl) && !!decl.type && !decl.getSourceFile().isDeclarationFile && !!decl.parent.typeParameters?.some((tp) => (this.erasesTypeParameter(tp) || (!this.library && this.erasesGenerics(decl.parent))) && new RegExp(`\\b${tp.name.text}\\b`).test(decl.type.getText()))));
17
+ },
11
18
  /** The slot the parameter `p`, the `k`th, is at call `e` given `a`: Swift's type of it there, and how it takes a missing value. */
12
19
  paramSlot(e, p, k, a) {
13
20
  const decl = p.valueDeclaration;
14
21
  const slot = (target, facts) => argumentSlot(this.placement, target, decl, { call: e, k, a }, facts);
15
22
  // A method or constructor of a generic class Swift has erased: the parameter's type as the method declares it.
16
- const erased = (!!decl && ts.isParameter(decl) && ts.isClassLike(decl.parent.parent) && !!decl.parent.parent.typeParameters?.length && this.erasesGenerics(decl.parent.parent)) ||
17
- // A method of an app's generic interface, whose protocol erases the interface's type parameters.
18
- (!!decl && ts.isParameter(decl) && ts.isMethodSignature(decl.parent) && this.erasingProtocol(decl.parent)) ||
19
- // A program function's type parameter Swift erases (`U extends { root: View }`, any of a plugin's): the parameter as declared, the argument's type erased with it.
20
- (!!decl && ts.isParameter(decl) && !!decl.type && !decl.getSourceFile().isDeclarationFile && !!decl.parent.typeParameters?.some((tp) => (this.erasesTypeParameter(tp) || (!this.library && this.erasesGenerics(decl.parent))) && new RegExp(`\\b${tp.name.text}\\b`).test(decl.type.getText())));
23
+ const erased = this.erasedParam(decl);
21
24
  // An array of the class or a subclass where the function takes `JSArray<some C>`: the array itself.
22
25
  if (decl && ts.isParameter(decl) && this.opaqueArrayParam(decl))
23
26
  return slot(this.typeOf(a));
@@ -108,14 +111,14 @@ export const argumentsMethods = {
108
111
  const out = [];
109
112
  const restAt = params.findIndex((p) => p.valueDeclaration && ts.isParameter(p.valueDeclaration) && p.valueDeclaration.dotDotDotToken);
110
113
  // A function type's rest parameter too (`mainThreadify(fn)` gives `(...args) => void`, or `String.fromCharCode.bind(String)`): Swift's function type takes it as `JSRest`.
111
- const calleeRest = !this.library && ts.isCallExpression(e) && restAt >= 0 && functionParts(this.typeOf(e.expression).replace(/^\((.*)\)[?!]$/, '$1'))?.rest === restAt;
114
+ const calleeRest = !this.library && ts.isCallExpression(e) && restAt >= 0 && !isCoreDeclaration(sig?.getDeclaration()) && functionParts(this.typeOf(e.expression).replace(/^\((.*)\)[?!]$/, '$1'))?.rest === restAt;
112
115
  const appDeclared = (!!sig?.getDeclaration() && (!sig.getDeclaration().getSourceFile().isDeclarationFile || (!this.library && ts.isFunctionTypeNode(sig.getDeclaration())))) || calleeRest;
113
116
  let covered = list.length;
114
117
  for (let k = 0; k < list.length; k++) {
115
118
  const a = list[k];
116
119
  if (restAt >= 0 && k >= restAt && appDeclared) {
117
120
  // An app function's rest parameter is one array: the arguments packed, spreads included.
118
- const calleeParam = ts.isCallExpression(e) ? functionParts(this.typeOf(e.expression).replace(/^\((.*)\)[?!]$/, '$1'))?.params[restAt]?.replace(/^JSRest<(.*)>$/, 'JSArray<$1>') : undefined;
121
+ const calleeParam = !this.erasedParam(params[restAt].valueDeclaration) && ts.isCallExpression(e) ? functionParts(this.typeOf(e.expression).replace(/^\((.*)\)[?!]$/, '$1'))?.params[restAt]?.replace(/^JSRest<(.*)>$/, 'JSArray<$1>') : undefined;
119
122
  const rest = calleeParam && /^JSArray<.*>$/.test(calleeParam) ? calleeParam : this.restType(params[restAt]);
120
123
  out.push(this.packed(list.slice(k), rest, this.restSlot(e, rest.replace(/^JSArray<(.*)>$/, '$1'), params[restAt].valueDeclaration)));
121
124
  break;
@@ -143,8 +146,10 @@ export const argumentsMethods = {
143
146
  throw this.error(a, 'a spread argument');
144
147
  const held = this.typeOf(a.expression);
145
148
  const code = this.expr(a.expression);
149
+ const calleeParams = !appDeclared && ts.isCallExpression(e) ? functionParts(this.typeOf(e.expression).replace(/^\((.*)\)[?!]$/, '$1'))?.params : undefined;
146
150
  tuple.forEach((el, i) => {
147
- const given = this.type(this.checker.getTypeOfSymbolAtLocation(params[k + i], e), e);
151
+ const cp = calleeParams?.[k + i];
152
+ const given = cp && !cp.startsWith('JSRest<') ? cp.replace(/^@escaping /, '') : this.type(this.checker.getTypeOfSymbolAtLocation(params[k + i], e), e);
148
153
  const slot = this.spreadSlot(e, params[k + i], k + i, this.filledDefault(params[k + i].valueDeclaration) ? optionalType(given) : given);
149
154
  out.push(held.startsWith('(') && !functionParts(held) ? this.convert(`${code}.${i}`, this.type(el, e), slot.target) : this.presentFromAny(`${RT.jsArg}(${this.coerce(a.expression, 'JSArray<Any?>')}.storage, ${i})`, slot.target, true));
150
155
  });
@@ -188,7 +193,7 @@ export const argumentsMethods = {
188
193
  // A rest of a type parameter (`bind`'s `(...args: A) => R`): Swift's function type takes it as one untyped array.
189
194
  if (d.type && this.isBareTypeParameter(d.type))
190
195
  return 'JSArray<Any?>';
191
- const t = this.typeOf(d.name);
196
+ const t = this.inFile(d.getSourceFile().fileName, () => this.typeOf(d.name));
192
197
  return isUntyped(spelledType(t)) ? 'JSArray<Any?>' : t;
193
198
  },
194
199
  /** The arguments of a call on an untyped value from its `from`th: each, or with spreads, all as one list. */
@@ -244,8 +244,13 @@ export const assignmentMethods = {
244
244
  if (d && ts.isVariableDeclaration(d) && !d.initializer && !ts.isSourceFile(d.parent.parent.parent))
245
245
  return this.marks.assignedCode(this.expr(left), 'nil');
246
246
  }
247
- if (ts.isPropertyAccessExpression(left) && this.isAddedMember(left))
247
+ if (ts.isPropertyAccessExpression(left) && this.isAddedMember(left)) {
248
+ const target = this.checker.getNonNullableType(this.checker.getTypeAtLocation(left.expression));
249
+ if (target.isIntersection() && target.types.some((t) => this.native.type(t))) {
250
+ return `${RT.jsNativeSet}(${this.expr(left.expression)}, ${swiftString(left.name.text)}, ${this.stored(right, left, 'Any?', checks)})`;
251
+ }
248
252
  return `(${this.expr(left.expression)} as JSDynamic)[jsKey: ${swiftString(left.name.text)}] = ${this.stored(right, left, 'Any?', checks)}`;
253
+ }
249
254
  if (ts.isPropertyAccessExpression(left) && this.isNativeExpando(left))
250
255
  return `${RT.jsSetNativeExpando}(${this.expr(left.expression)}, ${swiftString(left.name.text)}, ${this.stored(right, left, 'Any?', checks)})`;
251
256
  if (ts.isPropertyAccessExpression(left) && this.isExpando(left))
@@ -1,6 +1,6 @@
1
1
  // Calls as Swift: functions, methods, prototype calls, JavaScript globals and statics, native dispatch.
2
2
  import ts from 'typescript';
3
- import { LIST_APPLIED, isTypedArrayType } from "./library.js";
3
+ import { LIB_FUNCTION_VALUES, LIST_APPLIED, isTypedArrayType } from "./library.js";
4
4
  import { isLibGlobal } from "../semantics/globals.js";
5
5
  import { comparedToNullish, functionParts, hasTopLevelArrow, ident, isFunctionType, isOptional, isSymbolAsyncIterator, openSwiftChain, optionalType, swiftString, RT } from "./syntax.js";
6
6
  import { assertedReceiverCell, nullishField } from "../semantics/placement.js";
@@ -33,6 +33,8 @@ export const callsMethods = {
33
33
  isDomGlobal(e) {
34
34
  if (this.library || !ts.isIdentifier(e) || (ts.isPropertyAccessExpression(e.parent) && e.parent.name === e) || ts.isTypeNode(e.parent))
35
35
  return false;
36
+ if (Object.hasOwn(LIB_FUNCTION_VALUES, e.text))
37
+ return false;
36
38
  const decls = this.resolve(e)?.declarations ?? [];
37
39
  // A plugin's name nothing declares here (`window` where its own build had the DOM's typings): the global object's, undefined.
38
40
  if (!decls.length)
@@ -484,9 +486,12 @@ export const callsMethods = {
484
486
  if (ts.isNonNullExpression(callee)) {
485
487
  if (!/[?!]$/.test(this.typeOf(callee.expression)))
486
488
  return this.call(ts.factory.updateCallExpression(e, callee.expression, e.typeArguments, e.arguments));
489
+ const fn = this.expr(callee.expression);
490
+ if (/^(?:try\s+)?FunctionCell_\w+\.present\(/.test(fn))
491
+ return `(${fn})(${this.args(e).join(', ')})`;
487
492
  const label = ts.isPropertyAccessExpression(callee.expression) || ts.isIdentifier(callee.expression) ? callee.expression.getText() : null;
488
493
  const fnType = this.typeOf(callee.expression).replace(/^\((.*)\)[?!]$/, '$1').replace(/[?!]$/, '');
489
- return label ? `({ () throws -> ${fnType} in guard let __fn = ${this.tryPrefix(callee.expression)}${this.expr(callee.expression)} else { throw JSException(JSTypeError(${swiftString(`${label} is not a function`)})) }; return __fn }())(${this.args(e).join(', ')})` : `${RT.jsCallee}(${this.expr(callee.expression)})(${this.args(e).join(', ')})`;
494
+ return label ? `({ () throws -> ${fnType} in guard let __fn = ${this.tryPrefix(callee.expression)}${fn} else { throw JSException(JSTypeError(${swiftString(`${label} is not a function`)})) }; return __fn }())(${this.args(e).join(', ')})` : `${RT.jsCallee}(${fn})(${this.args(e).join(', ')})`;
490
495
  }
491
496
  throw this.error(e, 'call');
492
497
  },
@@ -145,7 +145,8 @@ export const classMethodsMethods = {
145
145
  this.chainingLoose = true;
146
146
  const rawKey = this.propertyKey(m.name.expression);
147
147
  this.chainingLoose = saved;
148
- const key = fixedKey(m.name.expression, this.checker) ? rawKey : this.storedSymbolKey(k, m.name.expression, rawKey);
148
+ const keyThrows = this.throwsInfo.expr(m.name.expression);
149
+ const key = fixedKey(m.name.expression, this.checker) ? (keyThrows ? `(try? ${rawKey})` : rawKey) : this.storedSymbolKey(k, m.name.expression, rawKey);
149
150
  symbolMethods.push({ key, method, owner: ident(k.name), params: m.parameters.map((p) => this.paramType(p)), unread: m.parameters.map((p) => this.unreadParameter(m, p)), ret: this.returnTypeOf(m), throws: this.throwsInfo.fn(m) });
150
151
  lines.push(' ' + this.memberFunc(m, method));
151
152
  return;
@@ -19,8 +19,8 @@ export const BUILTIN_CLASSES = Object.assign(Object.create(null), { Promise: 'JS
19
19
  export const LIB_FUNCTION_VALUES = {
20
20
  clearTimeout: { code: `{ (__id: Any?) -> Void in ${RT.jsClearTimeout}(${RT.jsIsNullish}(__id) ? nil : ${RT.jsToNumber}(__id)) }`, type: '(Any?) throws -> Void' },
21
21
  clearInterval: { code: `{ (__id: Any?) -> Void in ${RT.jsClearInterval}(${RT.jsIsNullish}(__id) ? nil : ${RT.jsToNumber}(__id)) }`, type: '(Any?) throws -> Void' },
22
- queueMicrotask: { code: `{ (__f: @escaping () throws -> Void) -> Void in ${RT.jsQueueMicrotask} { ${RT.jsReport} { try __f() } } }`, type: '(() throws -> Void) throws -> Void' },
23
- requestAnimationFrame: { code: `{ (__f: @escaping (Double) throws -> Void) -> Double in ${RT.jsRequestAnimationFrame} { __t in ${RT.jsReport} { try __f(__t) } } }`, type: '((Double) throws -> Void) throws -> Double' },
22
+ queueMicrotask: { code: `{ (__f: @escaping () throws -> Void) -> Void in ${RT.jsQueueMicrotask} { ${RT.jsReport} { try __f() } } }`, type: '(@escaping () throws -> Void) throws -> Void' },
23
+ requestAnimationFrame: { code: `{ (__f: @escaping (Double) throws -> Void) -> Double in ${RT.jsRequestAnimationFrame} { __t in ${RT.jsReport} { try __f(__t) } } }`, type: '(@escaping (Double) throws -> Void) throws -> Double' },
24
24
  cancelAnimationFrame: { code: `{ (__id: Double?) -> Void in ${RT.jsCancelAnimationFrame}(__id) }`, type: '(Double?) throws -> Void' },
25
25
  };
26
26
  /** `Math`'s functions, by the Swift function each is. */
@@ -136,7 +136,8 @@ export const methodValuesMethods = {
136
136
  const params = fn.parameters.filter((p) => !(ts.isIdentifier(p.name) && p.name.text === 'this'));
137
137
  const ret = this.returnTypeOf(fn);
138
138
  const localType = (p) => (p.questionToken || (p.initializer && !this.templateParams) ? this.paramType(p) : this.states.mayBeNull(p) ? (this.lenient ? optionalType(this.typeOf(p.name)) : `${this.typeOf(p.name)}!`) : this.paramType(p));
139
- const selfType = declaresThis(fn) ? localType(fn.parameters[0]) : 'Any?';
139
+ const rawSelf = declaresThis(fn) ? localType(fn.parameters[0]) : 'Any?';
140
+ const selfType = !isUntyped(spelledType(rawSelf)) && !this.declaredNullable(fn.parameters[0]) ? rawSelf.replace(/\?$/, '!') : rawSelf;
140
141
  const selfBind = !isUntyped(spelledType(selfType)) ? [`let __self: ${selfType} = ${this.presentFromAny('__this', selfType.replace(/!$/, '?'), true, true)}`] : [];
141
142
  // A function reading `arguments` binds its parameters from them itself.
142
143
  const binds = [
@@ -56,6 +56,10 @@ export const namesMethods = {
56
56
  // A name nothing declares for iOS (`android`, `java`, Node's `__dirname`) is a value whose use throws.
57
57
  if (name === 'global' && (this.library ? !libDecl || libDecl.getSourceFile().isDeclarationFile : !!libDecl && libDecl.getSourceFile().isDeclarationFile))
58
58
  return 'jsGlobalThis';
59
+ // A timer or microtask function held as a value (`const clear = clearTimeout`, `requestAnimationFrame`, `queueMicrotask`), core's declaration of it too.
60
+ const held = !!libDecl && libDecl.getSourceFile().isDeclarationFile && Object.hasOwn(LIB_FUNCTION_VALUES, name) && !(ts.isCallExpression(e.parent) && e.parent.expression === e) ? LIB_FUNCTION_VALUES[name] : undefined;
61
+ if (held)
62
+ return this.convert(held.code, held.type, this.typeOf(e));
59
63
  if (this.isDomGlobal(e))
60
64
  return `jsGlobalThis[jsKey: ${swiftString(name)}]`;
61
65
  // The runtime gives the bundled app's module its folder in the app bundle.
@@ -81,10 +85,6 @@ export const namesMethods = {
81
85
  return sdk;
82
86
  return this.fromAnyCode(`jsGlobalThis[jsKey: ${swiftString(name)}]`, this.typeOf(e));
83
87
  }
84
- // A timer or microtask function held as a value (`const clear = clearTimeout`), core's declaration of it too.
85
- const held = !!libDecl && libDecl.getSourceFile().isDeclarationFile && Object.hasOwn(LIB_FUNCTION_VALUES, name) && !(ts.isCallExpression(e.parent) && e.parent.expression === e) ? LIB_FUNCTION_VALUES[name] : undefined;
86
- if (held)
87
- return this.convert(held.code, held.type, this.typeOf(e));
88
88
  // A global function core or the app only declares (`zonedCallback`, which core's globals set), as a value: the global object's.
89
89
  if (!this.library && libDecl && ts.isFunctionDeclaration(libDecl) && !libDecl.body && (appAmbient || isCoreDeclaration(libDecl)) && ts.isSourceFile(libDecl.parent) && !hasModifier(libDecl, ts.SyntaxKind.ExportKeyword))
90
90
  return 'jsGlobalThis[jsKey: ' + swiftString(name) + ']';
@@ -531,7 +531,7 @@ export const nativeCallsMethods = {
531
531
  const k = lookupConstant(native.module, native.name);
532
532
  if (!k)
533
533
  throw this.t.error(e, `${native.name} (${this.noCounterpart(native.module, native.name)})`, 'native');
534
- this.usesEnumOf(k, native.module, native.name);
534
+ this.usesEnumOf(k, native.module, native.name, e);
535
535
  return this.fromSwift(k.swift, k.type, e);
536
536
  },
537
537
  /**
@@ -544,16 +544,22 @@ export const nativeCallsMethods = {
544
544
  if (!k)
545
545
  continue;
546
546
  this.uses(module);
547
- this.usesEnumOf(k, module, e.text);
547
+ this.usesEnumOf(k, module, e.text, e);
548
548
  return this.fromSwift(k.swift, k.type, e);
549
549
  }
550
550
  return null;
551
551
  },
552
552
  /** A typed constant's enum is looked up among the modules in use, and may live in another table than the typings' module. */
553
- usesEnumOf(k, module, jsName) {
553
+ usesEnumOf(k, module, jsName, e) {
554
+ this.checkAvailable(k, e, jsName);
554
555
  const home = k.enumType ? constantModule(module, jsName) : null;
555
556
  if (home)
556
557
  this.uses(home);
558
+ if (k.enumType) {
559
+ const en = lookupEnum(home ?? module, k.enumType);
560
+ if (en)
561
+ this.checkAvailable(en, e, k.enumType);
562
+ }
557
563
  },
558
564
  /** A native function of no arguments as a value (`isRunning = UIAccessibilityIsVoiceOverRunning`): a closure calling it, as Swift may have it as a property. */
559
565
  functionValue(e, native) {
@@ -3,7 +3,7 @@ import { heldLoss } from "../semantics/losses.js";
3
3
  import ts from 'typescript';
4
4
  import { convertedRead } from "../semantics/states/predicates.js";
5
5
  import { place } from "../semantics/placement.js";
6
- import { THROWING_CODE, escapingFunction, escapingParam, functionParts, hasTopLevelArrow, ident, isFunctionType, isNullish, isOptional, nullishType, numberLiteralBranch, numericLiteralOnly, optionalType, postfixChain, splitTopLevel, swiftString, unwrapFunction, RT, lenientReader } from "./syntax.js";
6
+ import { THROWING_CODE, escapingFunction, escapingParam, functionParts, hasTopLevelArrow, ident, isFunctionType, isNullish, isOptional, nullishType, numberLiteralBranch, numericLiteralOnly, optionalElementsType, optionalType, postfixChain, splitTopLevel, swiftString, unwrapFunction, RT, lenientReader } from "./syntax.js";
7
7
  import { structural } from "../semantics/conversion.js";
8
8
  import { heldOf, isKit, isNamed, isUntyped, parseNativeType, spelledType } from "../semantics/types.js";
9
9
  import { isLibDeclaration, isWriteTarget, notIterable } from "../semantics/ast.js";
@@ -19,8 +19,10 @@ export const placementMethods = {
19
19
  loweredReturn(e, slot) {
20
20
  const own = this.typeOf(e).replace(/[?!]$/, ''), promise = `JSPromise<${slot.target}>`;
21
21
  // The `try` marks the value: a return through a finally holds it in a block, which a `try` cannot mark.
22
- if (!isKit(spelledType(own), 'JSPromise'))
23
- return [this.marks.tryBefore(this.tryPrefix(e), place(this.placement, e, slot)), false];
22
+ if (!isKit(spelledType(own), 'JSPromise')) {
23
+ const placed = place(this.placement, e, slot);
24
+ return [this.marks.tryBefore(this.tryPrefix(e) || (THROWING_CODE.test(placed) ? 'try ' : ''), placed), false];
25
+ }
24
26
  // A promise of another type than the function's (`Promise<[Status, boolean]>` returned where `Promise<any>` is): its value converted.
25
27
  const adopt = (code) => (own !== promise ? this.convert(code, own, promise) : code);
26
28
  const read = this.typeOf(e);
@@ -617,6 +619,19 @@ export const placementMethods = {
617
619
  return this.array(bare, 'JSArray<Any?>');
618
620
  return this.convert(this.expr(e), source, target);
619
621
  }
622
+ // An array of typed promises where an array of untyped promises is wanted (`Promise<void>[]` as `Promise<unknown>[]`).
623
+ if (!this.library && /^JSArray<JSPromise<.+>>[?!]?$/.test(source) && /^JSArray<JSPromise<Any\?>>[?!]?$/.test(target) && !/^JSArray<JSPromise<Any\?>>[?!]?$/.test(source)) {
624
+ const fromPromise = source.replace(/^JSArray<(.*)>[?!]?$/, '$1');
625
+ return `(${this.expr(e)} as ${source.replace(/[?!]$/, '')}).map { ${this.convert('$0', fromPromise, 'JSPromise<Any?>')} }`;
626
+ }
627
+ // A Set or Array whose elements Swift held optional (`optionalElements`), placed where non-optional elements are declared.
628
+ if (!this.library && source !== target && source === optionalElementsType(target) && /^JS(Set|Array)<.+>\??$/.test(target)) {
629
+ const el = target.replace(/^JS(?:Set|Array)<(.*)>\??$/, '$1');
630
+ if (!isUntyped(spelledType(el))) {
631
+ const kind = target.startsWith('JSSet<') ? 'JSSet' : 'JSArray';
632
+ return `${kind}<${el}>(${this.expr(e)}.map { ${this.undefinedAs('$0', el, optionalType(el))} })`;
633
+ }
634
+ }
620
635
  if (/^JSPromise<(Any\?|JSArray<Any\?>)>$/.test(source) && /^JSPromise<.*>[?!]?$/.test(target) && source !== target.replace(/[?!]$/, '')) {
621
636
  const all = ts.isCallExpression(bare) && ts.isPropertyAccessExpression(bare.expression) && bare.expression.name.text === 'all' && ts.isIdentifier(bare.expression.expression) && bare.expression.expression.text === 'Promise' && isLibGlobal(this, bare.expression.expression) && bare.arguments.length === 1 && !ts.isArrayLiteralExpression(bare.arguments[0]) ? bare : null;
622
637
  return all ? this.untypedAll(all.arguments[0], target) : this.convert(this.expr(e), source, target);
@@ -112,7 +112,7 @@ export const staticCallsMethods = {
112
112
  case 'Array':
113
113
  if (method === 'isArray') {
114
114
  const g = !this.library ? shapeArrayGuardAccess(arg(0), (t) => this.isObjectShape(t), (x) => this.typeOf(x)) : null;
115
- return `JSArray<Any?>.isArray(${g ? `${this.expr(g.prop.expression)}${g.optional ? '?' : ''}[jsKey: ${swiftString(g.prop.name.text)}]` : this.restArgument(e, arg(0), 'Any?')})`;
115
+ return `JSArray<Any?>.isArray(${g ? `${this.expr(g.prop.expression)}${g.optional && this.typeOf(g.prop.expression).endsWith('?') ? '?' : ''}[jsKey: ${swiftString(g.prop.name.text)}]` : this.restArgument(e, arg(0), 'Any?')})`;
116
116
  }
117
117
  if (method === 'from' && e.arguments.length === 1)
118
118
  return `${T()}.from(${this.iterable(arg(0))})`;
@@ -385,7 +385,7 @@ export const SWIFT_SYNTAX = {
385
385
  asyncBody: (cap) => [`${cap}.body {`, '}'],
386
386
  // Undefined where the result has no undefined (a tuple, after branches that each return): reached only where the types are wrong.
387
387
  asyncReturn: (cap, value, isPromise, result) => (value === null ? `${cap}.returnValue(${result === 'Void' ? '()' : /^\(.*\)$/.test(result) && !/->/.test(result) ? `{ fatalError("undefined for ${result}") }()` : 'nil'})` : `${cap}.${isPromise ? 'returnPromise' : 'returnValue'}(${value})`),
388
- asyncError: (cap) => `{ ${cap}.throwValue($0) }`,
388
+ asyncError: (cap) => `${cap}.throwValue`,
389
389
  loopRun: (iteration) => `JSAsyncLoop().run ${iteration}`,
390
390
  undefinedValue: 'nil',
391
391
  generatorBody: (cap, element, isAsync) => [`return ${isAsync ? 'JSAsyncGenerator' : 'JSGenerator'}<${element}> { (${cap}: ${isAsync ? 'JSAsyncGeneratorContext' : 'JSGeneratorContext'}) throws -> Void in`, '}'],
@@ -338,8 +338,8 @@ export const typesMethods = {
338
338
  return `${this.appModule}.${this.topNames().get(sym.valueDeclaration ?? sym.declarations[0]) ?? name}`;
339
339
  }
340
340
  if (name && name !== '__type' && name !== '__object') {
341
- // Library mode: an interface only a declaration file has (the DOM's `MediaQueryListEvent`, core's `AddChildFromBuilder`) has no Swift type.
342
- if (this.library && sym && sym.flags & ts.SymbolFlags.Interface && !(sym.flags & ts.SymbolFlags.Class) && sym.declarations?.every((d) => d.getSourceFile().isDeclarationFile && ((isLibDeclaration(d) && (/lib\.dom/.test(d.getSourceFile().fileName) || DESCRIPTORS.has(name))) || isCoreDeclaration(d))))
341
+ // An interface only a declaration file has (the DOM's `MediaQueryListEvent`, `AddEventListenerOptions`, `Document`, core's `AddChildFromBuilder` in library mode) has no Swift type.
342
+ if (sym && sym.flags & ts.SymbolFlags.Interface && !(sym.flags & ts.SymbolFlags.Class) && sym.declarations?.every((d) => d.getSourceFile().isDeclarationFile && ((isLibDeclaration(d) && (/lib\.dom/.test(d.getSourceFile().fileName) || (this.library && DESCRIPTORS.has(name)))) || (this.library && isCoreDeclaration(d)))))
343
343
  return 'Any?';
344
344
  if (sym?.declarations?.some((d) => !d.getSourceFile().isDeclarationFile))
345
345
  this.used.add(name);
@@ -64,6 +64,15 @@ object AppModules {
64
64
  if (name !in names) names.add(name)
65
65
  null
66
66
  })
67
+ jsSet(jsGlobalThis, "requestAnimationFrame", jsFunction { a ->
68
+ val cb = a.getOrNull(0)
69
+ requestAnimationFrame { t -> jsCall(cb, t) }
70
+ })
71
+ jsSet(jsGlobalThis, "cancelAnimationFrame", jsFunction { a ->
72
+ val id = a.getOrNull(0)
73
+ cancelAnimationFrame(if (id == null || id === jsNull) null else jsToNumber(id))
74
+ null
75
+ })
67
76
  }
68
77
  }
69
78
 
@@ -279,8 +279,12 @@ public enum Core_ui_builder_index {
279
279
  jsAwait(
280
280
  value: try jsObjectRequired(Builder.load(pathOrOptions, context)),
281
281
  { (__t_1: View) -> Void in
282
- __async1.returnValue(jsObjectRequired(__t_1))
283
- }, { __async1.throwValue($0) })
282
+ do {
283
+ __async1.returnValue(try jsObjectRequired(__t_1))
284
+ } catch {
285
+ __async1.throwValue(jsCaught(error))
286
+ }
287
+ }, __async1.throwValue)
284
288
  }
285
289
  return __async1.promise
286
290
  }
@@ -146,7 +146,7 @@ open class ObservableArray: Observable, JSStringConvertible, JSToJSONConvertible
146
146
  { (__t_1: Any?) -> Void in
147
147
  _ = __t_1
148
148
  __continue1()
149
- }, { __gen1.throwValue($0) },
149
+ }, __gen1.throwValue,
150
150
  { (__r_1: Any?) -> Void in
151
151
  __gen1.returnValue(__r_1)
152
152
  })
@@ -502,7 +502,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
502
502
  size, Double(jsUnwrap(data, "length").length))
503
503
  {
504
504
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:306)
505
- __resolvers1.resolve(true)
505
+ try __resolvers1.resolve(true)
506
506
  } else {
507
507
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:308)
508
508
  try jsCallable(reject, "reject")(
@@ -689,7 +689,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
689
689
  try jsCallable(reject, "reject")(error)
690
690
  } else {
691
691
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:414)
692
- __resolvers5.resolve()
692
+ try __resolvers5.resolve()
693
693
  }
694
694
  }))
695
695
  } catch {
@@ -767,7 +767,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
767
767
  try jsCallable(reject, "reject")(error)
768
768
  } else {
769
769
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:458)
770
- __resolvers6.resolve()
770
+ try __resolvers6.resolve()
771
771
  }
772
772
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:460)
773
773
  try jsUnwrap(handle, "closeFile").closeFile()
@@ -824,7 +824,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
824
824
  try jsCallable(reject, "reject")(error)
825
825
  } else {
826
826
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:491)
827
- __resolvers7.resolve()
827
+ try __resolvers7.resolve()
828
828
  }
829
829
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:493)
830
830
  try jsUnwrap(handle, "closeFile").closeFile()
@@ -893,7 +893,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
893
893
  try jsCallable(reject, "reject")(error)
894
894
  } else {
895
895
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:528)
896
- __resolvers8.resolve()
896
+ try __resolvers8.resolve()
897
897
  }
898
898
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:530)
899
899
  try jsUnwrap(handle, "closeFile").closeFile()
@@ -958,7 +958,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
958
958
  try
959
959
  ({ () throws -> Void in
960
960
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:563)
961
- __resolvers9.resolve()
961
+ try __resolvers9.resolve()
962
962
  })()
963
963
  }
964
964
  })
@@ -1002,7 +1002,7 @@ open class FileSystemAccess: JSDynamic, JSExpando, JSStaticKeyed {
1002
1002
  "", 0,
1003
1003
  { () throws -> Void in
1004
1004
  #sourceLocation(file:"@nativescript/core/file-system.file-system-access.ios.ts",line:587)
1005
- __resolvers10.resolve()
1005
+ try __resolvers10.resolve()
1006
1006
  }))
1007
1007
  } catch {
1008
1008
  #sourceLocation()
@@ -100,7 +100,7 @@ open class FileSystemEntity: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
100
100
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:82)
101
101
  if !hasError {
102
102
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:83)
103
- __resolvers1.resolve(true)
103
+ try __resolvers1.resolve(true)
104
104
  }
105
105
  }
106
106
  }
@@ -149,7 +149,7 @@ open class FileSystemEntity: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
149
149
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:116)
150
150
  if !hasError {
151
151
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:117)
152
- __resolvers2.resolve(true)
152
+ try __resolvers2.resolve(true)
153
153
  }
154
154
  }
155
155
  }
@@ -500,7 +500,7 @@ open class File: FileSystemEntity {
500
500
  "", 0,
501
501
  { () throws -> Void in
502
502
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:379)
503
- __resolvers3.resolve()
503
+ try __resolvers3.resolve()
504
504
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:380)
505
505
  self._locked = false
506
506
  }),
@@ -573,7 +573,7 @@ open class File: FileSystemEntity {
573
573
  "", 0,
574
574
  { () throws -> Void in
575
575
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:426)
576
- __resolvers4.resolve(true)
576
+ try __resolvers4.resolve(true)
577
577
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:427)
578
578
  self._locked = false
579
579
  }),
@@ -646,7 +646,7 @@ open class File: FileSystemEntity {
646
646
  "", 1,
647
647
  { (result: Any?) throws -> Void in
648
648
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:473)
649
- __resolvers5.resolve(try jsConvertedBool(result))
649
+ try __resolvers5.resolve(try jsConvertedBool(result))
650
650
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:474)
651
651
  self._locked = false
652
652
  }),
@@ -712,7 +712,7 @@ open class File: FileSystemEntity {
712
712
  "", 1,
713
713
  { (result: Any?) throws -> Void in
714
714
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:520)
715
- __resolvers6.resolve(result)
715
+ try __resolvers6.resolve(result)
716
716
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:521)
717
717
  self._locked = false
718
718
  }),
@@ -778,7 +778,7 @@ open class File: FileSystemEntity {
778
778
  "", 0,
779
779
  { () throws -> Void in
780
780
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:567)
781
- __resolvers7.resolve()
781
+ try __resolvers7.resolve()
782
782
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:568)
783
783
  self._locked = false
784
784
  }),
@@ -850,7 +850,7 @@ open class File: FileSystemEntity {
850
850
  "", 1,
851
851
  { (result: Any?) throws -> Void in
852
852
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:614)
853
- __resolvers8.resolve(try jsConvertedString(result))
853
+ try __resolvers8.resolve(try jsConvertedString(result))
854
854
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:615)
855
855
  self._locked = false
856
856
  }),
@@ -918,7 +918,7 @@ open class File: FileSystemEntity {
918
918
  "", 0,
919
919
  { () throws -> Void in
920
920
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:660)
921
- __resolvers9.resolve(true)
921
+ try __resolvers9.resolve(true)
922
922
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:661)
923
923
  self._locked = false
924
924
  }),
@@ -1118,7 +1118,7 @@ open class Folder: FileSystemEntity {
1118
1118
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:736)
1119
1119
  if !hasError {
1120
1120
  #sourceLocation(file:"@nativescript/core/file-system.index.ts",line:737)
1121
- __resolvers10.resolve(true)
1121
+ try __resolvers10.resolve(true)
1122
1122
  }
1123
1123
  }
1124
1124
  }
@@ -318,7 +318,7 @@ public enum Core_http_http_request_internal_index {
318
318
  #sourceLocation(file:"@nativescript/core/http.http-request-internal.index.ios.ts",line:166)
319
319
  if jsTruthy(image) {
320
320
  #sourceLocation(file:"@nativescript/core/http.http-request-internal.index.ios.ts",line:167)
321
- __resolvers2.resolve(image)
321
+ try __resolvers2.resolve(image)
322
322
  } else {
323
323
  #sourceLocation(file:"@nativescript/core/http.http-request-internal.index.ios.ts",line:169)
324
324
  try jsCallable(