@tlua/tlua-linux-arm 0.0.38 → 0.0.40

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.
@@ -47,24 +47,6 @@ interface LuaPairsIterator<K, V> {
47
47
  // user signatures, resolved specially by the checker.
48
48
  type NoInfer<T> = intrinsic;
49
49
 
50
- // Inert Promise surface. tlua has no await and no Promise semantics; these
51
- // exist only so `import(...)` and the residual `async` modifier keep
52
- // type-checking. Deliberately member-poor.
53
- interface PromiseLike<T> {
54
- then(onfulfilled?: (value: T) => any, onrejected?: (reason: any) => any): PromiseLike<T>;
55
- }
56
-
57
- interface Promise<T> {
58
- then(onfulfilled?: (value: T) => any, onrejected?: (reason: any) => any): Promise<T>;
59
- }
60
-
61
- interface PromiseConstructor {
62
- readonly prototype: Promise<any>;
63
- resolve<T>(value: T | PromiseLike<T>): Promise<T>;
64
- resolve(): Promise<void>;
65
- }
66
- declare Promise: PromiseConstructor;
67
-
68
50
  // The erasable type-operator utilities inherited from TypeScript. These are
69
51
  // pure type sugar over machinery the checker supports (mapped, conditional,
70
52
  // and intrinsic string types); no runtime surface.
@@ -109,14 +91,6 @@ type NonNullable<T> = T & {};
109
91
  /** Obtain the return type of a function type */
110
92
  type ReturnType<T extends (...: any) => any> = T extends (...: any) => infer R ? R : any;
111
93
 
112
- /** Recursively unwrap the value type of a thenable */
113
- type Awaited<T> = T extends null | undefined ? T :
114
- T extends table & { then(onfulfilled: infer F, ...: infer _): any; } ?
115
- F extends ((value: infer V, ...: infer _) => any) ?
116
- Awaited<V> :
117
- never :
118
- T;
119
-
120
94
  /** Convert string literal type to uppercase */
121
95
  type Uppercase<S extends string> = intrinsic;
122
96
 
@@ -132,7 +106,7 @@ type Uncapitalize<S extends string> = intrinsic;
132
106
  interface LuaMetatable<T extends table> {
133
107
  __index?: Table<any, any> | ((value: T, key: any) => any);
134
108
  __newindex?: Table<any, any> | ((value: T, key: any, newValue: any) => void);
135
- __call?: async (value: T, ...: any) => (any?, ...any);
109
+ __call?: suspend (value: T, ...: any) => (any?, ...any);
136
110
  __tostring?: (value: T) => string;
137
111
  __len?: (value: T) => number;
138
112
  __unm?: (value: T) => any;
@@ -217,6 +191,10 @@ declare function xpcall(fn: function, handler: (message: any) => any, ...: any):
217
191
  * generic `T`. The whole coroutine module stays erased: resume/yield because a
218
192
  * `thread` is opaque and carries no packs (Luau makes the same call), and wrap
219
193
  * because a wrapped call exchanges values with `yield`, not with fn's packs.
194
+ * That erasure is about packs only -- `coroutine.yield` still carries the suspend
195
+ * flag, because it is the primitive the whole contract is founded on. `resume`
196
+ * and a wrapped function do not: driving a coroutine from ordinary code is what
197
+ * they are for.
220
198
  *
221
199
  * The signatures of setmetatable and getmetatable stay deliberately plain: the
222
200
  * checker pairs a table with its metatable itself. A call to the *global*
@@ -228,7 +206,7 @@ declare function xpcall(fn: function, handler: (message: any) => any, ...: any):
228
206
  * metamethods also dispatch ambiently: a declared type that states them as
229
207
  * `__add`-style members (a userdata class like GMod's Vector) overloads the
230
208
  * operators with no setmetatable in sight; __index, __newindex and __call stay
231
- * pairing-only. The __call slot is async-typed so a handler may carry the
209
+ * pairing-only. The __call slot is suspend-typed so a handler may carry the
232
210
  * coroutine contract -- a sync handler satisfies it too, and the pairing's call
233
211
  * surface keeps whichever flavor the handler declares.
234
212
  * debug.setmetatable and debug.getmetatable bypass __metatable protection. A
@@ -250,7 +228,16 @@ interface CoroutineLib {
250
228
  // parameter/return packs would assert types that are wrong for every coroutine
251
229
  // that yields, which is what wrap is for.
252
230
  wrap(fn: function): function;
253
- yield(...: any): (any?, ...any);
231
+ // `yield` is the primitive that actually suspends the running coroutine, so
232
+ // it anchors the suspend contract: everything else marked `suspend` is marked
233
+ // by hand, and this is the one signature the contract can be founded on. A
234
+ // function whose body yields must therefore declare itself `suspend`, and a
235
+ // yield reached from ordinary code -- the runtime's "attempt to yield from
236
+ // outside a coroutine" -- is a diagnostic instead. The `suspend` modifier is
237
+ // illegal in an ambient context, so this is a property carrying a suspend
238
+ // function *type*; the argument and result types stay erased exactly as
239
+ // resume's do. Widening to the `function` top type is the escape hatch.
240
+ yield: suspend (...: any) => (any?, ...any);
254
241
  }
255
242
 
256
243
  declare coroutine: CoroutineLib;
@@ -466,6 +453,7 @@ interface DebugLib {
466
453
  sethook(thread: thread, hook?: function, mask?: string, count?: number): void;
467
454
  setlocal(level: number, localIndex: number, value: any): string | nil;
468
455
  setlocal(thread: thread, level: number, localIndex: number, value: any): string | nil;
456
+ setmetatable<T extends table>(value: T, metatable: LuaMetatable<T> | nil): T;
469
457
  setmetatable<T>(value: T, metatable: table | nil): T;
470
458
  setupvalue(fn: function, index: number, value: any): string | nil;
471
459
  traceback(message?: any, level?: number): string;
package/lib/tlua CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tlua/tlua-linux-arm",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "license": "Apache-2.0",
5
5
  "author": "tlua",
6
6
  "homepage": "https://github.com/apyrr/tlua",
@@ -32,7 +32,7 @@
32
32
  "exports": {
33
33
  "./package.json": "./package.json"
34
34
  },
35
- "gitHead": "fd72da4a6df495275246ceafaf390894567f3e47",
35
+ "gitHead": "f31116b7dc888e8bd7156171bc2027703f38ae09",
36
36
  "publishConfig": {
37
37
  "access": "public",
38
38
  "tag": "latest"