@ttsc/wasm 0.16.2 → 0.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ttsc.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -189,6 +189,12 @@ func NewNodeVisitor(visit func(node *Node) *Node, factory *NodeFactory, options
|
|
|
189
189
|
return innerast.NewNodeVisitor(visit, factory, options)
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
// GetCombinedModifierFlags returns syntactic modifiers combined across wrappers
|
|
193
|
+
// such as variable statements and their declaration lists.
|
|
194
|
+
func GetCombinedModifierFlags(node *Node) ModifierFlags {
|
|
195
|
+
return innerast.GetCombinedModifierFlags(node)
|
|
196
|
+
}
|
|
197
|
+
|
|
192
198
|
// IsFunctionLike reports whether node is any function-like construct
|
|
193
199
|
// (function declaration, arrow function, method, constructor, accessor, etc.).
|
|
194
200
|
func IsFunctionLike(node *Node) bool {
|
|
@@ -81,7 +81,7 @@ func Checker_getPropertiesOfType(recv *innerchecker.Checker, t *innerchecker.Typ
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Checker_getApparentProperties returns the properties visible on t after
|
|
84
|
-
// resolving primitive wrapper types (e.g. string
|
|
84
|
+
// resolving primitive wrapper types (e.g. string to String).
|
|
85
85
|
func Checker_getApparentProperties(recv *innerchecker.Checker, t *innerchecker.Type) []*innerast.Symbol {
|
|
86
86
|
return recv.GetApparentProperties(t)
|
|
87
87
|
}
|
|
@@ -149,6 +149,16 @@ func Checker_getAliasedSymbol(recv *innerchecker.Checker, symbol *innerast.Symbo
|
|
|
149
149
|
return recv.GetAliasedSymbol(symbol)
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// Checker_getExportsOfModule returns the exported symbols of a source-file or
|
|
153
|
+
// namespace module symbol, resolving export-star aggregation the same way the
|
|
154
|
+
// checker does for emit and services.
|
|
155
|
+
func Checker_getExportsOfModule(recv *innerchecker.Checker, symbol *innerast.Symbol) []*innerast.Symbol {
|
|
156
|
+
if recv == nil || symbol == nil {
|
|
157
|
+
return nil
|
|
158
|
+
}
|
|
159
|
+
return recv.GetExportsOfModule(symbol)
|
|
160
|
+
}
|
|
161
|
+
|
|
152
162
|
//go:linkname checkerResolveEntityName github.com/microsoft/typescript-go/internal/checker.(*Checker).resolveEntityName
|
|
153
163
|
func checkerResolveEntityName(
|
|
154
164
|
recv *innerchecker.Checker,
|
|
@@ -215,8 +225,8 @@ func Checker_getBaseTypes(recv *innerchecker.Checker, t *innerchecker.Type) []*i
|
|
|
215
225
|
func checkerGetDeclaredTypeOfSymbol(recv *innerchecker.Checker, symbol *innerast.Symbol) *innerchecker.Type
|
|
216
226
|
|
|
217
227
|
// Checker_getDeclaredTypeOfSymbol returns the declared (instance) type of a
|
|
218
|
-
// class or interface symbol. Unlike Checker_getTypeOfSymbol
|
|
219
|
-
// constructor (static) type of a class symbol
|
|
228
|
+
// class or interface symbol. Unlike Checker_getTypeOfSymbol, which yields the
|
|
229
|
+
// constructor (static) type of a class symbol, the result IS a
|
|
220
230
|
// ClassOrInterface type and is therefore safe to feed back into
|
|
221
231
|
// Checker_getBaseTypes. This lets a consumer resolve a generic base's symbol to
|
|
222
232
|
// its declared type and keep walking the base chain past the generic boundary
|
|
@@ -275,10 +285,10 @@ func Checker_getReturnTypeOfSignature(recv *innerchecker.Checker, signature *inn
|
|
|
275
285
|
// parameter is excluded (it is held separately from the value parameters).
|
|
276
286
|
//
|
|
277
287
|
// Checker_getMinArgumentCount alone cannot tell a zero-parameter signature
|
|
278
|
-
// (`()`
|
|
288
|
+
// (`()` minimum 0) from a single-optional-parameter one (`(x?)` also
|
|
279
289
|
// minimum 0). A type-transform plugin needs that distinction to replicate the
|
|
280
|
-
// type-level "single meaningful argument" rule
|
|
281
|
-
// and every later parameter must be optional or rest
|
|
290
|
+
// type-level "single meaningful argument" rule: a FIRST parameter must exist
|
|
291
|
+
// and every later parameter must be optional or rest, as
|
|
282
292
|
// `Signature_parameterCount(sig) >= 1 && Checker_getMinArgumentCount(c, sig) <= 1`.
|
|
283
293
|
// Without it the `new C(x)` / `C.from(x)` strategies silently fall back to field
|
|
284
294
|
// copy for every optional-first constructor or factory. Returns 0 if signature
|
|
@@ -297,7 +307,7 @@ func Signature_parameterCount(signature *innerchecker.Signature) int {
|
|
|
297
307
|
// yields the seed TYPE the plugin must decode before constructing the instance.
|
|
298
308
|
//
|
|
299
309
|
// Signature_parameterCount is len() of this slice; the slice itself is needed
|
|
300
|
-
// because detection (count + min-args) is not enough
|
|
310
|
+
// because detection (count + min-args) is not enough; emission requires the
|
|
301
311
|
// seed parameter's type. Returns nil if signature is nil.
|
|
302
312
|
func Signature_parameters(signature *innerchecker.Signature) []*innerast.Symbol {
|
|
303
313
|
if signature == nil {
|
|
@@ -308,8 +318,8 @@ func Signature_parameters(signature *innerchecker.Signature) []*innerast.Symbol
|
|
|
308
318
|
|
|
309
319
|
// Signature_hasRestParameter reports whether the signature's last value
|
|
310
320
|
// parameter is a rest parameter (`...xs: S[]`). It is the signal a from/new
|
|
311
|
-
// transform needs to tell a rest-only single-seed call `(...xs: S[])
|
|
312
|
-
// seed is the ELEMENT S
|
|
321
|
+
// transform needs to tell a rest-only single-seed call `(...xs: S[])`, whose
|
|
322
|
+
// seed is the ELEMENT S, from a genuine array-typed parameter `(seed: S[])`,
|
|
313
323
|
// whose seed is the array S[]: getTypeOfSymbol yields `S[]` for BOTH, so without
|
|
314
324
|
// this flag they are indistinguishable and the rest case decodes the wrong
|
|
315
325
|
// shape.
|
|
@@ -317,8 +327,8 @@ func Signature_parameters(signature *innerchecker.Signature) []*innerast.Symbol
|
|
|
317
327
|
// The rest ELEMENT is the seed ONLY when the rest parameter is the sole value
|
|
318
328
|
// parameter, i.e. `Signature_hasRestParameter(sig) && Signature_parameterCount(sig) == 1`.
|
|
319
329
|
// A leading-required + rest-tail signature `(s: S, ...r: R[])` also has a rest
|
|
320
|
-
// parameter (this returns true), but its seed is the FIRST parameter S
|
|
321
|
-
// from Signature_parameters(sig)[0], NOT the rest element
|
|
330
|
+
// parameter (this returns true), but its seed is the FIRST parameter S. Read it
|
|
331
|
+
// from Signature_parameters(sig)[0], NOT the rest element, matching
|
|
322
332
|
// ClassifiableSeed, whose `[infer P, ...Rest]` arm picks P=S there. Returns
|
|
323
333
|
// false if signature is nil.
|
|
324
334
|
func Signature_hasRestParameter(signature *innerchecker.Signature) bool {
|
|
@@ -330,7 +340,7 @@ func Signature_hasRestParameter(signature *innerchecker.Signature) bool {
|
|
|
330
340
|
|
|
331
341
|
// Checker_getRestTypeOfSignature returns the ELEMENT type of the signature's
|
|
332
342
|
// rest parameter (`...xs: S[]` -> S; a tuple rest unwraps to its element too),
|
|
333
|
-
// which is the seed type for a rest-ONLY single-argument constructor/factory
|
|
343
|
+
// which is the seed type for a rest-ONLY single-argument constructor/factory,
|
|
334
344
|
// matching ClassifiableSeed, which unwraps the rest to its element. When the
|
|
335
345
|
// signature has NO rest parameter it falls back to `any` upstream; and a
|
|
336
346
|
// leading-required + rest-tail `(s: S, ...r: R[])` has a rest parameter yet its
|